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>
impl<V> IpLCTrieMap<V>
Sourcepub fn len(&self) -> NonZeroUsize
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)
Sourcepub fn get(&self, ipnet: &IpNet) -> Option<&V>
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.
Sourcepub fn get_mut(&mut self, ipnet: &IpNet) -> Option<&mut V>
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.
Sourcepub fn lookup(&self, ipnet: &IpNet) -> (IpNet, &V)
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.
Sourcepub fn lookup_mut(&mut self, ipnet: &IpNet) -> (IpNet, &mut V)
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.
Sourcepub fn iter(&self) -> impl Iterator<Item = (IpNet, &V)> + '_
pub fn iter(&self) -> impl Iterator<Item = (IpNet, &V)> + '_
Iterates over all the entries.
For a mutable access of values, use Self::iter_mut
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (IpNet, &mut V)> + '_
pub fn iter_mut(&mut self) -> impl Iterator<Item = (IpNet, &mut V)> + '_
Iterates over all the entries with a mutable access to values.
Sourcepub fn prefixes(&self) -> IpLCTrieSet
pub fn prefixes(&self) -> IpLCTrieSet
Gets a set of copy of all the keys in a trie set.