[][src]Trait smoltcp::phy::TxToken

pub trait TxToken {
    pub fn consume<R, F>(
        self,
        timestamp: Instant,
        len: usize,
        f: F
    ) -> Result<R>
    where
        F: FnOnce(&mut [u8]) -> Result<R>
; }

A token to transmit a single network packet.

Required methods

pub fn consume<R, F>(self, timestamp: Instant, len: usize, f: F) -> Result<R> where
    F: FnOnce(&mut [u8]) -> Result<R>, 
[src]

Consumes the token to send a single network packet.

This method constructs a transmit buffer of size len and calls the passed closure f with a mutable reference to that buffer. The closure should construct a valid network packet (e.g. an ethernet packet) in the buffer. When the closure returns, the transmit buffer is sent out.

The timestamp must be a number of milliseconds, monotonically increasing since an arbitrary moment in time, such as system startup.

Loading content...

Implementors

Loading content...