IpLCTrieMap

Struct IpLCTrieMap 

Source
pub struct IpLCTrieMap<V> {
    pub ipv4: Ipv4LCTrieMap<V>,
    pub ipv6: Ipv6LCTrieMap<V>,
}
Expand description

A LC-trie map that mix both Ipv4 and Ipv6 prefixes

Fields§

§ipv4: Ipv4LCTrieMap<V>§ipv6: Ipv6LCTrieMap<V>

Implementations§

Source§

impl<V> IpLCTrieMap<V>

Source

pub fn len(&self) -> NonZeroUsize

Returns the size of the map.

Notice that it always greater or equals two since two top prefixes are always present in the map (one for Ipv4 and the other for Ipv6)

Source

pub fn get(&self, ipnet: &IpNet) -> Option<&V>

Gets the value associated with an exact match of the key.

To access to the longest prefix match, use Self::lookup.

To get a mutable access to a value, use Self::get_mut.

Source

pub fn get_mut(&mut self, ipnet: &IpNet) -> Option<&mut V>

Gets a mutable access to the value associated with an exact match of the key.

To access to the longest prefix match, use Self::lookup_mut.

To get a mutable access to a value, use Self::get_mut.

Source

pub fn lookup(&self, ipnet: &IpNet) -> (IpNet, &V)

Gets the value associated with the longest prefix match of the key.

As the top prefix always matches, the lookup never fails.

To access to the exact prefix match, use Self::get.

To get a mutable access to a value, use Self::lookup_mut.

Source

pub fn lookup_mut(&mut self, ipnet: &IpNet) -> (IpNet, &mut V)

Gets a mutable access to the value associated with a longest prefix match of the key.

To access to the exact prefix match, use Self::get_mut.

Source

pub fn iter(&self) -> impl Iterator<Item = (IpNet, &V)> + '_

Iterates over all the entries.

For a mutable access of values, use Self::iter_mut

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (IpNet, &mut V)> + '_

Iterates over all the entries with a mutable access to values.

Source

pub fn prefixes(&self) -> IpLCTrieSet

Gets a set of copy of all the keys in a trie set.

Trait Implementations§

Source§

impl<V: Default> FromIterator<(IpNet, V)> for IpLCTrieMap<V>

Source§

fn from_iter<I: IntoIterator<Item = (IpNet, V)>>(iter: I) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl<V> Freeze for IpLCTrieMap<V>

§

impl<V> RefUnwindSafe for IpLCTrieMap<V>
where V: RefUnwindSafe,

§

impl<V> Send for IpLCTrieMap<V>
where V: Send,

§

impl<V> Sync for IpLCTrieMap<V>
where V: Sync,

§

impl<V> Unpin for IpLCTrieMap<V>
where V: Unpin,

§

impl<V> UnwindSafe for IpLCTrieMap<V>
where V: 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> 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, 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.