Function riot_wrappers::gcoap::register

source ·
pub fn register<P>(listener: &'static mut P)
where P: 'static + ListenerProvider,
Available on riot_module_gcoap only.
Expand description

Append a Gcoap listener in the global list of listeners, so that incoming requests are compared to the listener’s match functions and, if matching, are run through its handlers.

Obtaining a static listener is relatively hard (in particular because storing it somewhere static often requires naming its type, and that’s both tedious until type_alias_impl_trait is stabilized and hard with how handler generators like to return an impl trait). It is often easier to construct them in a scoped fashion with RegistrationScope::register.