Trait embassy_net_driver::TxToken
source · pub trait TxToken {
// Required method
fn consume<R, F>(self, len: usize, f: F) -> R
where F: FnOnce(&mut [u8]) -> R;
}
Expand description
A token to transmit a single network packet.
Required Methods§
sourcefn consume<R, F>(self, len: usize, f: F) -> Rwhere
F: FnOnce(&mut [u8]) -> R,
fn consume<R, F>(self, len: usize, f: F) -> Rwhere 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.
Object Safety§
This trait is not object safe.