Skip to main content

SplitStackTable

Struct SplitStackTable 

Source
pub struct SplitStackTable<Node> { /* private fields */ }
Expand description

Routing table that segregates routes into independent IPv4 and IPv6 tables.

This is likely the kind of table you want unless you know you’ll be operating in an exclusively-single-stack environment and want to save the slight runtime overhead of discriminating on address type.

Implementations§

Source§

impl<T, C> SplitStackTable<Node<T, C>>
where C: ?Sized + Storage,

Source

pub const EMPTY: Self

The empty table.

Source§

impl<Node> SplitStackTable<Node>
where Node: StrideOps,

Source

pub fn size4(&self) -> usize

Report the total number of IPv4 routes stored in the table.

Source

pub fn size6(&self) -> usize

Report the total number of IPv6 routes stored in the table.

Source

pub const fn root(&self, ipv4: bool) -> &Node

Get a reference to the root node for the given ip stack.

Trait Implementations§

Source§

impl<Node: Clone> Clone for SplitStackTable<Node>

Source§

fn clone(&self) -> SplitStackTable<Node>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Node: Copy> Copy for SplitStackTable<Node>

Source§

impl<Node: Debug> Debug for SplitStackTable<Node>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Node: Default> Default for SplitStackTable<Node>

Source§

fn default() -> SplitStackTable<Node>

Returns the “default value” for a type. Read more
Source§

impl<Node: Eq> Eq for SplitStackTable<Node>

Source§

impl<Node: Hash> Hash for SplitStackTable<Node>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<Node: PartialEq> PartialEq for SplitStackTable<Node>

Source§

fn eq(&self, other: &SplitStackTable<Node>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Node> RoutingTable for SplitStackTable<Node>
where Node: StrideOps,

Source§

type Value = <Node as StrideBase>::T

The value stored in each route.
Source§

fn contains(&self, ip: IpAddr) -> bool

Report whether ip is covered by a route in the table. Read more
Source§

fn insert(&mut self, prefix: IpNet, val: Node::T) -> Option<Node::T>

Insert a route into the table at prefix. Read more
Source§

fn remove(&mut self, prefix: IpNet) -> Option<Node::T>

Remove the route from the table with the given prefix. Read more
Source§

fn clear(&mut self)

Wipe the whole table.
Source§

fn lookup(&self, ip: IpAddr) -> Option<&Node::T>

Lookup the route that most closely covers ip. Read more
Source§

fn lookup_all(&self, ip: IpAddr) -> LookupIter<'_, Self::Value>

Lookup all matches that cover ip. Read more
Source§

fn lookup_prefix_exact(&self, prefix: IpNet) -> Option<&Node::T>

Lookup a route that exactly matches prefix (supernets do not match). Read more
Source§

fn lookup_prefix(&self, prefix: IpNet) -> Option<&Node::T>

Lookup the route that most closely covers prefix. Read more
Source§

fn lookup_prefix_lpm(&self, prefix: IpNet) -> Option<(IpNet, &Node::T)>

Lookup the route that most closely covers prefix, and return that matching prefix. Read more
Source§

fn size(&self) -> usize

Report the number of routes stored in the table. Read more
Source§

impl<Node> StructuralPartialEq for SplitStackTable<Node>

Auto Trait Implementations§

§

impl<Node> Freeze for SplitStackTable<Node>
where Node: Freeze,

§

impl<Node> RefUnwindSafe for SplitStackTable<Node>
where Node: RefUnwindSafe,

§

impl<Node> Send for SplitStackTable<Node>
where Node: Send,

§

impl<Node> Sync for SplitStackTable<Node>
where Node: Sync,

§

impl<Node> Unpin for SplitStackTable<Node>
where Node: Unpin,

§

impl<Node> UnsafeUnpin for SplitStackTable<Node>
where Node: UnsafeUnpin,

§

impl<Node> UnwindSafe for SplitStackTable<Node>
where Node: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> RoutingTableExt for T
where T: RoutingTable,

Source§

fn modify( &mut self, prefix: IpNet, modify: impl FnOnce(Option<&mut Self::Value>) -> RouteModification<Self::Value>, ) -> Option<Self::Value>

Modify the route at prefix using the modify closure. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.