Skip to main content

Module channel

Module channel 

Source
Expand description

Crossbeam-style MPMC channel over crate::Queue.

Sender<T, N> and Receiver<T, N> are cloneable handles to a shared backing crate::Queue. Multiple producers can hold their own Sender; multiple consumers can hold their own Receiver. The semantics match std::sync::mpsc / crossbeam::channel:

  • Sender::send blocks until the queue accepts the item, or returns Error::NetClosed if all receivers have been dropped.
  • Receiver::recv blocks until a producer sends, or returns Error::NetClosed if all senders have been dropped.
  • Sender::try_send / Receiver::try_recv are non-blocking variants returning Error::Timeout when empty/full.

Variants:

  • Heap mode (channel) — convenience constructor that allocates the queue + a refcount on the heap. Requires the alloc feature.
  • Static mode (Sender::from_static) — wraps a caller-owned &'static Queue<T, N> for zero-heap builds; refcount lives in a companion &'static AtomicUsize you provide.

Mirrors zephyr::sync::channel::{Sender, Receiver} but rides on the existing ove_queue_* FFI so frames can bridge to C producers / consumers (the C side just calls ove_queue_send / _receive and stays oblivious of the Rust-side refcount).

Structs§

Receiver
Multi-consumer half of an ove::channel.
Sender
Multi-producer half of an ove::channel.

Functions§

channel
Construct a heap-allocated channel with one initial sender + one initial receiver. Clone either half to fan out.