embassy-net-driver

Crates

git

Versions

default

Flavors

TxToken

Trait TxToken 

Source
pub trait TxToken {
    // Required method
    fn consume<R, F>(self, len: usize, f: F) -> R
       where F: FnOnce(&mut [u8]) -> R;

    // Provided methods
    fn id(&self) -> u8 { ... }
    fn set_meta(&mut self, meta: PacketMeta) { ... }
}
Expand description

A token to transmit a single network packet.

Required Methods§

Source

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

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.

Provided Methods§

Source

fn id(&self) -> u8

Get the ID for this packet that will be associated with poll_timestamp.

Source

fn set_meta(&mut self, meta: PacketMeta)

The Packet metadata to be associated with the frame to be transmitted by this TxToken.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§