pub fn channel<T>(init: T) -> (Sender<T>, Receiver<T>) {
    const INIT_ID: u64 = 0;

    let inner = Arc::new(WatchInner::new());

    // Insert the watcher
    let mut watchers = FnvHashMap::with_capacity_and_hasher(0, Default::default());
    watchers.insert(INIT_ID, inner.clone());

    let shared = Arc::new(Shared {
        value: RwLock::new(init),
        version: AtomicUsize::new(2),
        watchers: Mutex::new(Watchers {
            next_id: INIT_ID + 1,
            watchers,
        }),
        cancel: AtomicTask::new(),
    });

    let tx = Sender {
        shared: Arc::downgrade(&shared),
    };

    let rx = Receiver {
        shared,
        inner,
        id: INIT_ID,
        ver: 0,
    };

    (tx, rx)
}
/// Create a new watch channel, returning the "send" and "receive" handles.
///
/// All values sent by `Sender` will become visible to the `Receiver` handles.
/// Only the last value sent is made available to the `Receiver` half. All
/// intermediate values are dropped.
///
/// # Examples
///
/// ```
/// # extern crate futures;
/// extern crate tokio;
///
/// use tokio::prelude::*;
/// use tokio::sync::watch;
///
/// # tokio::run(futures::future::lazy(|| {
/// let (mut tx, rx) = watch::channel("hello");
///
/// tokio::spawn(rx.for_each(|value| {
///     println!("received = {:?}", value);
///     Ok(())
/// }).map_err(|_| ()));
///
/// tx.broadcast("world").unwrap();
/// # Ok(())
/// # }));
/// ```
Create a new watch channel, returning the "send" and "receive" handles.
All values sent by `Sender` will become visible to the `Receiver` handles.
Only the last value sent is made available to the `Receiver` half. All
intermediate values are dropped.
Create a new watch channel returning the " send " and " receive " handles . All values sent by ` Sender ` will become visible to the ` Receiver ` handles . Only the last value sent is made available to the ` Receiver ` half . All intermediate values are dropped .
pub fn channel<T>(init: T) -> (Sender<T>, Receiver<T>) {
    const INIT_ID: u64 = 0;
    let inner = Arc::new(WatchInner::new());
    // Insert the watcher
    let mut watchers = FnvHashMap::with_capacity_and_hasher(0, Default::default());
    watchers.insert(INIT_ID, inner.clone());
    let shared = Arc::new(Shared {
        value: RwLock::new(init),
        version: AtomicUsize::new(2),
        watchers: Mutex::new(Watchers {
            next_id: INIT_ID + 1,
            watchers,
        }),
        cancel: AtomicTask::new(),
    });
    let tx = Sender {
        shared: Arc::downgrade(&shared),
    };
    let rx = Receiver {
        shared,
        inner,
        id: INIT_ID,
        ver: 0,
    };
    (tx, rx)
}
pub fn channel < T > ( init : T ) -> ( Sender < T > , Receiver < T > ) { const INIT_ID : u64 = 0 ; let inner = Arc :: new ( WatchInner :: new ( ) ) ; // Insert the watcher let mut watchers = FnvHashMap :: with_capacity_and_hasher ( 0 , Default :: default ( ) ) ; watchers . insert ( INIT_ID , inner . clone ( ) ) ; let shared = Arc :: new ( Shared { value : RwLock :: new ( init ) , version : AtomicUsize :: new ( 2 ) , watchers : Mutex :: new ( Watchers { next_id : INIT_ID + 1 , watchers , } ) , cancel : AtomicTask :: new ( ) , } ) ; let tx = Sender { shared : Arc :: downgrade ( & shared ) , } ; let rx = Receiver { shared , inner , id : INIT_ID , ver : 0 , } ; ( tx , rx ) }
Create a new watch channel, returning the "send" and "receive" handles.
Create a new watch channel returning the " send " and " receive " handles .
init
T
examples
None
extern crate futures;
extern crate tokio.

use tokio::prelude::*;
use tokio::sync::watch.
extern crate tokio . use tokio :: prelude :: * ; use tokio :: sync :: watch .
tokio::run(futures::future::lazy(|| {
let (mut tx, rx) = watch::channel("hello").



tx.broadcast("world").unwrap().
let ( mut tx rx ) = watch :: channel ( " hello " ) . tx . broadcast ( " world " ) . unwrap () .
ok(())
None
}));
None