pub fn send(mut self, t: T) -> Result<(), T> {
        let inner = self.inner.take().unwrap();

        inner.value.with_mut(|ptr| unsafe {
            *ptr = Some(t);
        });

        if !inner.complete() {
            unsafe {
                return Err(inner.consume_value().unwrap());
            }
        }

        Ok(())
    }
/// Attempts to send a value on this channel, returning it back if it could
/// not be sent.
///
/// This method consumes `self` as only one value may ever be sent on a oneshot
/// channel. It is not marked async because sending a message to an oneshot
/// channel never requires any form of waiting.  Because of this, the `send`
/// method can be used in both synchronous and asynchronous code without
/// problems.
///
/// A successful send occurs when it is determined that the other end of the
/// channel has not hung up already. An unsuccessful send would be one where
/// the corresponding receiver has already been deallocated. Note that a
/// return value of `Err` means that the data will never be received, but
/// a return value of `Ok` does *not* mean that the data will be received.
/// It is possible for the corresponding receiver to hang up immediately
/// after this function returns `Ok`.
///
/// # Examples
///
/// Send a value to another task
///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
///     let (tx, rx) = oneshot::channel();
///
///     tokio::spawn(async move {
///         if let Err(_) = tx.send(3) {
///             println!("the receiver dropped");
///         }
///     });
///
///     match rx.await {
///         Ok(v) => println!("got = {:?}", v),
///         Err(_) => println!("the sender dropped"),
///     }
/// }
/// ```
Attempts to send a value on this channel, returning it back if it could
not be sent.

This method consumes `self` as only one value may ever be sent on a oneshot
channel. It is not marked async because sending a message to an oneshot
channel never requires any form of waiting.  Because of this, the `send`
method can be used in both synchronous and asynchronous code without
problems.

A successful send occurs when it is determined that the other end of the
channel has not hung up already. An unsuccessful send would be one where
the corresponding receiver has already been deallocated. Note that a
return value of `Err` means that the data will never be received, but
a return value of `Ok` does *not* mean that the data will be received.
It is possible for the corresponding receiver to hang up immediately
after this function returns `Ok`.
Attempts to send a value on this channel returning it back if it could not be sent . This method consumes ` self ` as only one value may ever be sent on a oneshot channel . It is not marked async because sending a message to an oneshot channel never requires any form of waiting . Because of this the ` send ` method can be used in both synchronous and asynchronous code without problems . A successful send occurs when it is determined that the other end of the channel has not hung up already . An unsuccessful send would be one where the corresponding receiver has already been deallocated . Note that a return value of ` Err ` means that the data will never be received but a return value of ` Ok ` does * not * mean that the data will be received . It is possible for the corresponding receiver to hang up immediately after this function returns ` Ok ` .
pub fn send(mut self, t: T) -> Result<(), T> {
        let inner = self.inner.take().unwrap();
        inner.value.with_mut(|ptr| unsafe {
            *ptr = Some(t);
        });
        if !inner.complete() {
            unsafe {
                return Err(inner.consume_value().unwrap());
            }
        }
        Ok(())
    }
pub fn send ( mut self , t : T ) -> Result < ( ) , T > { let inner = self . inner . take ( ) . unwrap ( ) ; inner . value . with_mut ( | ptr | unsafe { * ptr = Some ( t ) ; } ) ; if ! inner . complete ( ) { unsafe { return Err ( inner . consume_value ( ) . unwrap ( ) ) ; } } Ok ( ( ) ) }
Attempts to send a value on this channel, returning it back if it could
not be sent.
Attempts to send a value on this channel returning it back if it could not be sent .
mut self
t
T
examples
Send a value to another task

```
use tokio::sync::oneshot.
Send a value to another task ` ` ` use tokio :: sync :: oneshot .
[tokio::main]
async fn main() {
let (tx, rx) = oneshot::channel().

:spawn(async move {
if let Err(_) = tx.send(3) {
println!("the receiver dropped");
}
}).


async fn main () { let ( tx rx ) = oneshot :: channel () . : spawn ( async move { if let Err ( _ ) = tx . send ( 3 ) { println! ( " the receiver dropped " ) ; } } ) .