pub struct SpscReceiver { /* private fields */ }Expand description
SPSC consumer handle for a SharedLayout events region.
Semantics (v1):
- nonblocking receive (
Ok(None)when empty) try_recv_withborrows slot bytes only for the duration of the callback
Implementations§
Source§impl SpscReceiver
impl SpscReceiver
Sourcepub fn try_recv_into(&self, out: &mut [u8]) -> Result<Option<usize>, Error>
pub fn try_recv_into(&self, out: &mut [u8]) -> Result<Option<usize>, Error>
Ok(Some(len))on successOk(None)if queue emptyErr(BufferTooSmall)ifoutis too small
Sourcepub fn try_recv_with<F, R, E>(
&self,
f: F,
) -> Result<Option<R>, RecvWithError<E>>
pub fn try_recv_with<F, R, E>( &self, f: F, ) -> Result<Option<R>, RecvWithError<E>>
Receive by borrowing the slot bytes for the duration of f.
This enables zero-copy parsing/decoding in adapter layers.
The borrowed &[u8] is only valid for the duration of the callback.
§Errors
If the callback returns Err, the message is still considered consumed; it will not be
re-delivered by this receiver.
Sourcepub fn try_recv_slot(&self) -> Result<Option<EventsSlot>, Error>
pub fn try_recv_slot(&self) -> Result<Option<EventsSlot>, Error>
Receive a message as an owned slot handle.
The returned slot is valid until it is dropped (which frees it back to the pool) or
forwarded via publish_slot.
Trait Implementations§
impl Send for SpscReceiver
Auto Trait Implementations§
impl Freeze for SpscReceiver
impl !RefUnwindSafe for SpscReceiver
impl !Sync for SpscReceiver
impl Unpin for SpscReceiver
impl !UnwindSafe for SpscReceiver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more