pub trait RxToken {
fn consume<R, F>(self, timestamp: Instant, f: F) -> Result<R>
where
F: FnOnce(&mut [u8]) -> Result<R>;
}
Expand description
A token to receive a single network packet.
Required Methods§
sourcefn consume<R, F>(self, timestamp: Instant, f: F) -> Result<R>where
F: FnOnce(&mut [u8]) -> Result<R>,
fn consume<R, F>(self, timestamp: Instant, f: F) -> Result<R>where
F: FnOnce(&mut [u8]) -> Result<R>,
Consumes the token to receive a single network packet.
This method receives a packet and then calls the given closure f
with the raw
packet bytes as argument.
The timestamp must be a number of milliseconds, monotonically increasing since an arbitrary moment in time, such as system startup.