riot_wrappers::gnrc::netreg::callback

Trait Callback

Source
pub trait Callback: Send {
    // Required method
    fn called(&self, cmd: Command, snip: Pktsnip<Shared>);
}
Available on riot_module_gnrc_netapi_callbacks only.
Expand description

Callback trait for registration with netreg.

This is expressed as a trait rather than a FnMut because the callback generally needs to be statically allocated, and a closure (which can not be named) can not.

Required Methods§

Source

fn called(&self, cmd: Command, snip: Pktsnip<Shared>)

A network command to which the callback has been registered happened.

This just takes a &self because multiple threads could concurrently create network events from different devices.

Implementors§