pub fn send<M>(&self, msg: M) -> Result<OneshotReceiver<M::Result>, SendError<M>>
    where
        A: Handler<M>,
        A::Context: ToEnvelope<A, M>,
        M::Result: Send,
        M: Message + Send,
    {
        // If the sender is currently blocked, reject the message
        if !self.poll_unparked(false, None).is_ready() {
            return Err(SendError::Full(msg));
        }

        // First, increment the number of messages contained by the channel.
        // This operation will also atomically determine if the sender task
        // should be parked.
        //
        // None is returned in the case that the channel has been closed by the
        // receiver. This happens when `Receiver::close` is called or the
        // receiver is dropped.
        let park_self = match self.inc_num_messages() {
            Some(num_messages) => {
                // receiver is full
                let buffer = self.inner.buffer.load(Relaxed);
                buffer != 0 && num_messages >= buffer
            }
            None => return Err(SendError::Closed(msg)),
        };

        // If the channel has reached capacity, then the sender task needs to
        // be parked. This will send the task handle on the parked task queue.
        if park_self {
            self.park();
        }
        let (tx, rx) = oneshot_channel();
        let env = <A::Context as ToEnvelope<A, M>>::pack(msg, Some(tx));
        self.queue_push_and_signal(env);
        Ok(rx)
    }
/// Attempts to send a message on this `Sender<A>` with blocking.
///
/// This function must be called from inside of a task.
Attempts to send a message on this `Sender` with blocking.
This function must be called from inside of a task.
Attempts to send a message on this ` Sender ` with blocking . This function must be called from inside of a task .
pub fn send<M>(&self, msg: M) -> Result<OneshotReceiver<M::Result>, SendError<M>>
    where
        A: Handler<M>,
        A::Context: ToEnvelope<A, M>,
        M::Result: Send,
        M: Message + Send,
    {
        // If the sender is currently blocked, reject the message
        if !self.poll_unparked(false, None).is_ready() {
            return Err(SendError::Full(msg));
        }
        // First, increment the number of messages contained by the channel.
        // This operation will also atomically determine if the sender task
        // should be parked.
        //
        // None is returned in the case that the channel has been closed by the
        // receiver. This happens when `Receiver::close` is called or the
        // receiver is dropped.
        let park_self = match self.inc_num_messages() {
            Some(num_messages) => {
                // receiver is full
                let buffer = self.inner.buffer.load(Relaxed);
                buffer != 0 && num_messages >= buffer
            }
            None => return Err(SendError::Closed(msg)),
        };
        // If the channel has reached capacity, then the sender task needs to
        // be parked. This will send the task handle on the parked task queue.
        if park_self {
            self.park();
        }
        let (tx, rx) = oneshot_channel();
        let env = <A::Context as ToEnvelope<A, M>>::pack(msg, Some(tx));
        self.queue_push_and_signal(env);
        Ok(rx)
    }
pub fn send < M > ( & self , msg : M ) -> Result < OneshotReceiver < M :: Result > , SendError < M > > where A : Handler < M > , A :: Context : ToEnvelope < A , M > , M :: Result : Send , M : Message + Send , { // If the sender is currently blocked, reject the message if ! self . poll_unparked ( false , None ) . is_ready ( ) { return Err ( SendError :: Full ( msg ) ) ; } // First, increment the number of messages contained by the channel. // This operation will also atomically determine if the sender task // should be parked. // // None is returned in the case that the channel has been closed by the // receiver. This happens when `Receiver::close` is called or the // receiver is dropped. let park_self = match self . inc_num_messages ( ) { Some ( num_messages ) => { // receiver is full let buffer = self . inner . buffer . load ( Relaxed ) ; buffer != 0 && num_messages >= buffer } None => return Err ( SendError :: Closed ( msg ) ) , } ; // If the channel has reached capacity, then the sender task needs to // be parked. This will send the task handle on the parked task queue. if park_self { self . park ( ) ; } let ( tx , rx ) = oneshot_channel ( ) ; let env = < A :: Context as ToEnvelope < A , M > > :: pack ( msg , Some ( tx ) ) ; self . queue_push_and_signal ( env ) ; Ok ( rx ) }
Attempts to send a message on this `Sender<A>` with blocking.
Attempts to send a message on this ` Sender<A > ` with blocking .
&self
msg
M
&self
msg
M