Skip to main content

DeliveryToken

Struct DeliveryToken 

Source
pub struct DeliveryToken<'a, 'rx, E, R: ReceiverBackend, const MAX_STREAMS: usize> { /* private fields */ }
Expand description

Zero-copy delivery token returned by SrsppRxHandle::wait_for_message.

Holds &mut SrsppRxHandle, preventing another receive while the token is alive. The cell is not borrowed — the driver freely delivers new segments in the background.

Call consume with a synchronous closure to read the message and release the token in one step.

Implementations§

Source§

impl<'a, 'rx, E: Clone, R: ReceiverBackend, const MAX_STREAMS: usize> DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

Source

pub fn len(&self) -> usize

Byte length of the pending message.

Source

pub fn source(&self) -> Address

Source address of the sender that produced this message.

Source

pub fn consume<F, Ret>(self, f: F) -> Ret
where F: FnOnce(&[u8]) -> Ret,

Pass the message data to f, consume the token, and return whatever f returns.

The cell is borrowed only for the duration of f.

Auto Trait Implementations§

§

impl<'a, 'rx, E, R, const MAX_STREAMS: usize> Freeze for DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

§

impl<'a, 'rx, E, R, const MAX_STREAMS: usize> !RefUnwindSafe for DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

§

impl<'a, 'rx, E, R, const MAX_STREAMS: usize> !Send for DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

§

impl<'a, 'rx, E, R, const MAX_STREAMS: usize> !Sync for DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

§

impl<'a, 'rx, E, R, const MAX_STREAMS: usize> Unpin for DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

§

impl<'a, 'rx, E, R, const MAX_STREAMS: usize> UnsafeUnpin for DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

§

impl<'a, 'rx, E, R, const MAX_STREAMS: usize> !UnwindSafe for DeliveryToken<'a, 'rx, E, R, MAX_STREAMS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.