Module channel

Source
Expand description

Channels based on crate::fifo

§Example

let (tx, mut rx) = async_fifo::new();
tx.send_iter(['a', 'b', 'c']);

// Receive one by one
assert_eq!(rx.recv().await, Ok('a'));
assert_eq!(rx.recv().await, Ok('b'));
assert_eq!(rx.recv().await, Ok('c'));

core::mem::drop(tx);
assert_eq!(rx.recv().await, Err(Closed));

Modules§

non_blocking
oneshot
One shot SPSC channels

Structs§

Closed
An error type returned when the channel is closed
Fill
Future for Fifo consumption
Receiver
Asynchronous FIFO receiver
Recv
Future for Fifo consumption
Sender
Asynchronous FIFO sender

Traits§

FillStorage
Asynchronous variant of Storage (Borrowing)
RecvStorage
Asynchronous variant of Storage (Defaulting)

Functions§

new
Creates a channel with the default block size
oneshot
Create a new oneshot channel, returning a sender/receiver pair

Type Aliases§

FillExact
Future for Fifo consumption of N items
FillMany
Future for Fifo consumption of N items
RecvArray
Future for Fifo consumption of N items
RecvOne
Future for Fifo consumption of one item