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>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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.