Crate async_slot [−] [src]
The crate provides an unbounded channel that only stores last value sent.
There are two implementations a one is traditionally called
sync in the
futures world. It works across threads. And the
unsync one, which only
works in single thread, but is potentially more performant.
sync one which should be used by default is also reexported at
the root of this crate.
- Compacts memory (only last value is kept)
- Never has backpressure (because value is just replaced)
- Replaced value can be recovered if using
Sync, so if multi-producer is desired,
Sendercan be wrapped into an
swapmethod is used to update value.
let (tx, rx) = async_slot::channel::<i32>(); tx.send_all(iter_ok(vec![1, 2, 3])).wait(); let received = rx.collect().wait().unwrap(); assert_eq!(received, vec!);
A thread-safe variant of an unbounded channel that only stores last value sent
A single-thread variant of an unbounded channel that only stores last value sent
Error type for sending, used when the receiving end of a channel is dropped