Expand description
Ring-buffer channels built alongside crossbeam-channel, plus a Select wrapper
that can mix ring receivers with standard crossbeam-channel operations.
use crossbeam_ring_channel::{ring_bounded, select};
let (tx, rx) = ring_bounded(2);
tx.send(1).unwrap();
select! {
recv(rx) -> msg => {
assert_eq!(msg.unwrap(), 1);
},
}Macros§
- select
- Selects over ring receivers and crossbeam-channel send/recv operations.
- select_
biased - Selects like
select!, but prefers earlier arms when multiple are ready. - select_
internal - Internal macro used by
select!andselect_biased!.
Structs§
- Ring
Receiver - Receiver half of the ring-buffer channel.
- Ring
Sender - Sender half of the ring-buffer channel.
- Select
- Selection builder that mirrors crossbeam-channel’s
SelectAPI, but supports ring receivers. - Selected
Operation - Result of a selection.
Traits§
- Select
Recv - Trait implemented by receiver types that can be registered with
Select. - Select
Send - Trait implemented by sender types that can be registered with
Select. - Selected
Recv - Trait implemented by receiver types that can complete a selected receive.
- Selected
Send - Trait implemented by sender types that can complete a selected send.
Functions§
- ring_
bounded - Creates a ring-buffer channel with the given capacity.