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

pub struct Producer { /* fields omitted */ }

Writing end of a packet queue.

Methods

impl Producer[src]

pub fn has_space(&mut self, space: usize) -> bool[src]

Queries whether there is a free contiguous chunk of memory of at least space bytes.

pub fn free_space(&mut self) -> usize[src]

Returns the size of the largest contiguous free space in the queue (in Bytes).

pub fn produce_with<E>(
    &mut self,
    f: impl FnOnce(&mut ByteWriter) -> Result<Llid, E>
) -> Result<(), E> where
    E: From<Error>, 
[src]

Enqueue a new data channel PDU by passing a ByteWriter to a closure.

The closure has to write the PDU payload into the ByteWriter and must return the Llid to set in the header. The payload size is determined and written to the header automatically.

pub fn produce_pdu<L: ToBytes>(&mut self, payload: Pdu<L>) -> Result<(), Error>[src]

Enqueues a data channel PDU.

Returns Error::Eof when the queue does not have enough free space for both header and payload.

pub fn produce_raw(
    &mut self,
    header: Header,
    payload: &[u8]
) -> Result<(), Error>
[src]

Enqueues a data channel PDU, where the payload is given as raw bytes.

The payload will not be checked for validity.

Auto Trait Implementations

impl Send for Producer

impl !Sync for Producer

Blanket Implementations

impl<T> From for T[src]

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, 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]