riot_wrappers::gnrc::netreg

Function register_for_messages

Source
pub fn register_for_messages<F: FnOnce() -> !>(
    grant: SendPort<Pktsnip<Shared>, { _ }>,
    nettype: gnrc_nettype_t,
    demux_ctx: u32,
    f: F,
) -> !
Available on crate feature with_msg_v2 and riot_module_gnrc_pktbuf only.
Expand description

Set up a netreg for a particular kind of messages

§Roadmap

It might be convenient for this to return at some point (in case of short-lived network services). Deregistration could be done and everything returned alright – but the grant would still be lost. This could be mitigated by accepting a ’static PktsnipPort or a cloneable version thereof – not that anything could still be recombined after that, but at least it could be used once more (with the risk that messages from the old registration arrive in the new one, which is wrong correctness-wise but safe because it’ll still be a pointer to a pktsnip).

Any API rewrite would also replace the nettype/demux_ctx pair with a FullDemuxContext.