pub struct Sender<T: Copy + 'static, const N: usize> { /* private fields */ }Expand description
Multi-producer half of an ove::channel.
Implementations§
Source§impl<T: Copy + 'static, const N: usize> Sender<T, N>
impl<T: Copy + 'static, const N: usize> Sender<T, N>
Sourcepub const unsafe fn from_static(
queue: &'static Queue<T, N>,
tx_count: &'static AtomicUsize,
rx_count: &'static AtomicUsize,
) -> Self
pub const unsafe fn from_static( queue: &'static Queue<T, N>, tx_count: &'static AtomicUsize, rx_count: &'static AtomicUsize, ) -> Self
Construct a sender from caller-owned static state. Use for
zero-heap builds. The caller is responsible for ensuring the
matching Receiver::from_static uses the same queue,
tx_count, and rx_count and that both counts start at the
correct initial value (typically 1 each for one sender + one
receiver).
§Safety
Must be called with a queue and counts that are not already in use by another channel half.
Sourcepub fn send(&self, item: T) -> Result<()>
pub fn send(&self, item: T) -> Result<()>
Send an item. Blocks until the queue accepts it, or returns
Error::NetClosed if every Receiver has been dropped.
Sourcepub fn try_send(&self, item: T) -> Result<()>
pub fn try_send(&self, item: T) -> Result<()>
Non-blocking send. Returns Error::QueueFull when full,
Error::NetClosed when all receivers are gone.
Sourcepub fn sender_count(&self) -> usize
pub fn sender_count(&self) -> usize
Number of currently-live Sender handles. Snapshot only —
the count may change under concurrent clone/drop.
Sourcepub fn receiver_count(&self) -> usize
pub fn receiver_count(&self) -> usize
Number of currently-live Receiver handles.