[][src]Struct rubble::link::queue::Consumer

pub struct Consumer { /* fields omitted */ }

Reading end of a packet queue.

Methods

impl Consumer[src]

pub fn has_data(&mut self) -> bool[src]

Queries whether there is at least 1 packet that can be consumed.

pub fn consume_pdu_with<R>(
    &mut self,
    f: impl FnOnce(Header, Pdu<&[u8]>) -> Consume<R>
) -> Result<R, Error>
[src]

Tries to read a packet from the queue and passes it to f.

Returns Error::Eof if the queue is empty. Other errors can also be returned (eg. if parsing the data fails).

pub fn consume_raw_with<R>(
    &mut self,
    f: impl FnOnce(Header, &[u8]) -> Consume<R>
) -> Result<R, Error>
[src]

Auto Trait Implementations

impl Send for Consumer

impl !Sync for Consumer

Blanket Implementations

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> From for T[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]