riot_wrappers::gnrc_util

Trait RoundtripData

source
pub trait RoundtripData: Sized {
    // Required methods
    fn from_incoming(incoming: &Pktsnip<Shared>) -> Option<Self>;
    fn wrap(
        self,
        payload: Pktsnip<Shared>,
    ) -> Result<Pktsnip<Shared>, NotEnoughSpace>;
}
Available on riot_module_gnrc only.
Expand description

Trait of data structures that store all the information needed to respond to a Pktsnip in some way; the data (typically address and port information) is copied into the trait implementation and persisted there while the original snip is dropped and a new one is written.

This trait, in future, might also participate in the re-use of snips that are not dropped and re-allocated but turned into responses in-place, but whether that makes sense here remains to be seen.

Required Methods§

source

fn from_incoming(incoming: &Pktsnip<Shared>) -> Option<Self>

Read round trip data from an incoming packet.

This returns something if the packet can fundamentally be responded to, which is usually the case.

source

fn wrap( self, payload: Pktsnip<Shared>, ) -> Result<Pktsnip<Shared>, NotEnoughSpace>

Object Safety§

This trait is not object safe.

Implementors§

source§

impl RoundtripData for NetifRoundtripData

source§

impl<N: RoundtripData> RoundtripData for IPv6RoundtripDataFull<N>

Available on riot_module_ipv6 only.
source§

impl<N: RoundtripData> RoundtripData for UDPRoundtripDataFull<N>

Available on riot_module_gnrc_udp only.