LaneRxSlotBatch

Trait LaneRxSlotBatch 

Source
pub trait LaneRxSlotBatch: LaneRxSlot {
    // Provided method
    fn try_recv_slots<F>(
        &mut self,
        max: usize,
        f: F,
    ) -> Result<usize, LaneRxError>
       where F: FnMut(Self::Slot) -> bool { ... }
}
Expand description

RX side of a lane, batch slot receive.

This is a convenience API for draining up to max slots with a single call, allowing a lane backing to provide a more efficient implementation than looping try_recv_slot in the caller.

The default implementation repeatedly calls LaneRxSlot::try_recv_slot.

Provided Methods§

Source

fn try_recv_slots<F>(&mut self, max: usize, f: F) -> Result<usize, LaneRxError>
where F: FnMut(Self::Slot) -> bool,

Receive and process up to max slots.

Calls f once per slot. If f returns false, the drain stops early.

Returns the number of slots received (and passed to f).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> LaneRxSlotBatch for T
where T: LaneRxSlot,