[−][src]Crate flume
Flume
A blazingly fast multi-producer, multi-consumer channel.
"Do not communicate by sharing memory; instead, share memory by communicating."
Why Flume?
- Featureful: Unbounded, bounded and rendezvous queues
- Fast: Always faster than
std::sync::mpsc
and sometimescrossbeam-channel
- Safe: No
unsafe
code anywhere in the codebase! - Flexible:
Sender
andReceiver
both implementSend + Sync + Clone
- Familiar: Drop-in replacement for
std::sync::mpsc
- Capable: Additional features like MPMC support and send timeouts/deadlines
- Simple: Few dependencies, minimal codebase, fast to compile
- Asynchronous:
async
support, including mix 'n match with sync code - Ergonomic: Powerful
select
-like interface
Example
let (tx, rx) = flume::unbounded(); tx.send(42).unwrap(); assert_eq!(rx.recv().unwrap(), 42);
Re-exports
pub use select::Selector; |
Modules
async | Futures and other types that allow asynchronous interaction with channels. |
select | Types that permit waiting upon multiple blocking operations using the |
Structs
Drain | An fixed-sized iterator over the msgs drained from a channel. |
IntoIter | An owned iterator over the msgs received from a channel. |
Iter | An iterator over the msgs received from a channel. |
Receiver | The receiving end of a channel. |
SendError | An error that may be emitted when attempting to send a value into a channel on a sender when all receivers are dropped. |
Sender | A transmitting end of a channel. |
TryIter | An non-blocking iterator over the msgs received from a channel. |
Enums
RecvError | An error that may be emitted when attempting to wait for a value on a receiver when all senders are dropped and there are no more messages in the channel. |
RecvTimeoutError | An error that may be emitted when attempting to wait for a value on a receiver with a timeout when the receive operation times out or all senders are dropped and there are no values left in the channel. |
SendTimeoutError | An error that may be emitted when sending a value into a channel on a sender with a timeout when the send operation times out or all receivers are dropped. |
TryRecvError | An error that may be emitted when attempting to fetch a value on a receiver when there are no
messages in the channel. If there are no messages in the channel and all senders are dropped,
then |
TrySendError | An error that may be emitted when attempting to send a value into a channel on a sender when the channel is full or all receivers are dropped. |
Functions
bounded | Create a channel with a maximum capacity. |
unbounded | Create a channel with no maximum capacity. |