Trait linkspace::prelude::NetPkt

pub trait NetPkt: Debug {
    // Required methods
    fn as_point(&self) -> &dyn Point;
    fn hash_ref(&self) -> &B64;
    fn net_header_ref(&self) -> &NetPktHeader;
    fn recv(&self) -> Option<U64>;
    fn byte_segments(&self) -> ByteSegments<'_>;

    // Provided methods
    fn net_header_mut(&mut self) -> Option<&mut NetPktHeader> { ... }
    fn as_netbox(&self) -> Box<NetPktFatPtr> { ... }
    fn as_netarc(&self) -> NetPktArc  { ... }
}
Expand description

A trait to access fields of a net pkt. Auto impls NetPktExt, Point, and PointExt.

A NetPkt is the combination of Point, LkHash, NetPktHeader. the trait is impl for various layouts such as NetPktBox, NetPktArc.

There are wrapping structs in as [reroute] that provide extended options.

Required Methods§

fn as_point(&self) -> &dyn Point

fn hash_ref(&self) -> &B64

fn net_header_ref(&self) -> &NetPktHeader

fn recv(&self) -> Option<U64>

recv is somewhat special. It depends on the context. Reading directly from the database it should return the stamp at which it was inserted. NOTE: Do not rely on this value being unique - in the db or otherwise.

fn byte_segments(&self) -> ByteSegments<'_>

Provided Methods§

fn net_header_mut(&mut self) -> Option<&mut NetPktHeader>

fn as_netbox(&self) -> Box<NetPktFatPtr>

fn as_netarc(&self) -> NetPktArc

Trait Implementations§

§

impl From<&dyn NetPkt> for NetPktArc

§

fn from(value: &dyn NetPkt) -> NetPktArc

Converts to this type from the input type.
§

impl<A> From<&dyn NetPkt> for RecvPkt<A>where A: for<'o> From<&'o dyn NetPkt>,

§

fn from(value: &dyn NetPkt) -> RecvPkt<A>

Converts to this type from the input type.
source§

impl<'o> From<&'o dyn NetPkt> for UserData<'o>

source§

fn from(pkt: &'o dyn NetPkt) -> Self

Converts to this type from the input type.

Implementations on Foreign Types§

§

impl<T> NetPkt for Box<T>where T: NetPkt + ?Sized, Box<T>: Debug,

§

fn as_point(&self) -> &dyn Point

§

fn hash_ref(&self) -> &B64

§

fn net_header_ref(&self) -> &NetPktHeader

§

fn net_header_mut(&mut self) -> Option<&mut NetPktHeader>

§

fn recv(&self) -> Option<U64>

§

fn byte_segments(&self) -> ByteSegments<'_>

§

fn as_netbox(&self) -> Box<NetPktFatPtr>

§

fn as_netarc(&self) -> NetPktArc

§

impl<T> NetPkt for &Twhere T: NetPkt + ?Sized,

§

fn as_point(&self) -> &dyn Point

§

fn hash_ref(&self) -> &B64

§

fn net_header_ref(&self) -> &NetPktHeader

§

fn byte_segments(&self) -> ByteSegments<'_>

§

fn as_netbox(&self) -> Box<NetPktFatPtr>

§

fn as_netarc(&self) -> NetPktArc

§

fn net_header_mut(&mut self) -> Option<&mut NetPktHeader>

§

fn recv(&self) -> Option<U64>

§

impl<'a, T> NetPkt for &'a mut Twhere T: 'a + NetPkt + ?Sized, &'a mut T: Debug,

§

fn as_point(&self) -> &dyn Point

§

fn hash_ref(&self) -> &B64

§

fn net_header_ref(&self) -> &NetPktHeader

§

fn net_header_mut(&mut self) -> Option<&mut NetPktHeader>

§

fn recv(&self) -> Option<U64>

§

fn byte_segments(&self) -> ByteSegments<'_>

§

fn as_netbox(&self) -> Box<NetPktFatPtr>

§

fn as_netarc(&self) -> NetPktArc

Implementors§

§

impl NetPkt for NetPktArc

§

impl NetPkt for NetPktPtr

§

impl NetPkt for NetPktArcPtr

§

impl<'a> NetPkt for NetPktParts<'a>

§

impl<T> NetPkt for RecvPkt<T>where T: NetPkt + ?Sized,

§

impl<T> NetPkt for ReroutePkt<T>where T: NetPkt + ?Sized,

§

impl<T> NetPkt for ShareArcPkt<T>where T: NetPkt + ?Sized,