pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
    let inner = Arc::new(Inner {
        state: AtomicUsize::new(State::new().as_usize()),
        value: UnsafeCell::new(None),
        tx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
        rx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
    });

    let tx = Sender {
        inner: Some(inner.clone()),
    };
    let rx = Receiver { inner: Some(inner) };

    (tx, rx)
}
/// Create a new one-shot channel for sending single values across asynchronous
/// tasks.
///
/// The function returns separate "send" and "receive" handles. The `Sender`
/// handle is used by the producer to send the value. The `Receiver` handle is
/// used by the consumer to receive the value.
///
/// Each handle can be used on separate tasks.
///
/// # Examples
///
/// ```
/// 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"),
///     }
/// }
/// ```
Create a new one-shot channel for sending single values across asynchronous
tasks.

The function returns separate "send" and "receive" handles. The `Sender`
handle is used by the producer to send the value. The `Receiver` handle is
used by the consumer to receive the value.

Each handle can be used on separate tasks.
Create a new one - shot channel for sending single values across asynchronous tasks . The function returns separate " send " and " receive " handles . The ` Sender ` handle is used by the producer to send the value . The ` Receiver ` handle is used by the consumer to receive the value . Each handle can be used on separate tasks .
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
    let inner = Arc::new(Inner {
        state: AtomicUsize::new(State::new().as_usize()),
        value: UnsafeCell::new(None),
        tx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
        rx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
    });
    let tx = Sender {
        inner: Some(inner.clone()),
    };
    let rx = Receiver { inner: Some(inner) };
    (tx, rx)
}
pub fn channel < T > ( ) -> ( Sender < T > , Receiver < T > ) { let inner = Arc :: new ( Inner { state : AtomicUsize :: new ( State :: new ( ) . as_usize ( ) ) , value : UnsafeCell :: new ( None ) , tx_task : Task ( UnsafeCell :: new ( MaybeUninit :: uninit ( ) ) ) , rx_task : Task ( UnsafeCell :: new ( MaybeUninit :: uninit ( ) ) ) , } ) ; let tx = Sender { inner : Some ( inner . clone ( ) ) , } ; let rx = Receiver { inner : Some ( inner ) } ; ( tx , rx ) }
Create a new one-shot channel for sending single values across asynchronous
tasks.
Create a new one - shot channel for sending single values across asynchronous tasks .
examples
```
use tokio::sync::oneshot.
` ` ` 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 " ) ; } } ) .