pub async fn try_async_send<M: ChannelMessage>(
        &mut self,
        message: M,
    ) -> Result<(), TryAsyncMessageError> {
        let channels = self.channels.get_mut::<M>()?;

        if self.disconnected {
            Err(MessageChannelsDisconnected.into())
        } else {
            let res = async {
                future::poll_fn(|cx| channels.outgoing_sender.poll_ready(cx)).await?;
                channels.outgoing_sender.start_send(message)
            }
            .await;

            if res.is_err() {
                self.disconnected = true;
                Err(MessageChannelsDisconnected.into())
            } else {
                Ok(())
            }
        }
    }
/// Like `MessageChannels::async_send` but errors instead of panicking when the message type is
/// unregistered.
Like `MessageChannels::async_send` but errors instead of panicking when the message type is
unregistered.
Like ` MessageChannels :: async_send ` but errors instead of panicking when the message type is unregistered .
pub async fn try_async_send<M: ChannelMessage>(
        &mut self,
        message: M,
    ) -> Result<(), TryAsyncMessageError> {
        let channels = self.channels.get_mut::<M>()?;
        if self.disconnected {
            Err(MessageChannelsDisconnected.into())
        } else {
            let res = async {
                future::poll_fn(|cx| channels.outgoing_sender.poll_ready(cx)).await?;
                channels.outgoing_sender.start_send(message)
            }
            .await;
            if res.is_err() {
                self.disconnected = true;
                Err(MessageChannelsDisconnected.into())
            } else {
                Ok(())
            }
        }
    }
pub async fn try_async_send < M : ChannelMessage > ( & mut self , message : M , ) -> Result < ( ) , TryAsyncMessageError > { let channels = self . channels . get_mut :: < M > ( ) ? ; if self . disconnected { Err ( MessageChannelsDisconnected . into ( ) ) } else { let res = async { future :: poll_fn ( | cx | channels . outgoing_sender . poll_ready ( cx ) ) . await ? ; channels . outgoing_sender . start_send ( message ) } . await ; if res . is_err ( ) { self . disconnected = true ; Err ( MessageChannelsDisconnected . into ( ) ) } else { Ok ( ( ) ) } } }
Like `MessageChannels::async_send` but errors instead of panicking when the message type is
unregistered.
Like ` MessageChannels :: async_send ` but errors instead of panicking when the message type is unregistered .
&mut self
message
M
&mut self
message
M