Crate flume

source ·
Expand description

§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 sometimes crossbeam-channel
  • Safe: No unsafe code anywhere in the codebase!
  • Flexible: Sender and Receiver both implement Send + 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§

Modules§

  • Futures and other types that allow asynchronous interaction with channels.
  • Types that permit waiting upon multiple blocking operations using the Selector interface.

Structs§

  • An fixed-sized iterator over the msgs drained from a channel.
  • An owned iterator over the msgs received from a channel.
  • An iterator over the msgs received from a channel.
  • The receiving end of a channel.
  • An error that may be emitted when attempting to send a value into a channel on a sender when all receivers are dropped.
  • A transmitting end of a channel.
  • An non-blocking iterator over the msgs received from a channel.
  • A sender that does not prevent the channel from being closed.

Enums§

  • 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.
  • 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.
  • 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.
  • 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 TryRecvError::Disconnected will be returned.
  • 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§

  • Create a channel with a maximum capacity.
  • Create a channel with no maximum capacity.