pub struct RTrieMap<K, V>(_);Expand description
A map of Ip prefixes based on a radix binary trie
Implementations§
source§impl<K: IpPrefix, V: Default> RTrieMap<K, V>
impl<K: IpPrefix, V: Default> RTrieMap<K, V>
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new map.
The root prefix is associated with the default value of V.
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new map with a initial capacity.
The root prefix is associated with the default value of V.
source§impl<K: IpPrefix, V> RTrieMap<K, V>
impl<K: IpPrefix, V> RTrieMap<K, V>
sourcepub fn len(&self) -> NonZeroUsize
pub fn len(&self) -> NonZeroUsize
Returns the size of the map.
Notice that it is never null since the top prefix is always present in the map.
pub fn with_root(value: V) -> Self
pub fn with_root_and_capacity(value: V, capacity: usize) -> Self
pub fn compress(self) -> LCTrieMap<K, V>
pub fn insert(&mut self, k: K, v: V) -> Option<V>
pub fn get<Q>(&self, k: &Q) -> Option<&V>where Q: IpPrefix<Addr = K::Addr>, K: IpPrefixCovering<Q>,
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>where Q: IpPrefix<Addr = K::Addr>, K: IpPrefixCovering<Q>,
pub fn remove<Q>(&mut self, k: &Q) -> Option<V>where Q: IpPrefix<Addr = K::Addr>, K: IpPrefixCovering<Q>,
pub fn lookup<Q>(&self, k: &Q) -> (&K, &V)where Q: IpPrefix<Addr = K::Addr>, K: IpPrefixCovering<Q>,
pub fn lookup_mut<Q>(&mut self, k: &Q) -> (&K, &mut V)where Q: IpPrefix<Addr = K::Addr>, K: IpPrefixCovering<Q>,
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)> + '_
pub fn drain(&mut self) -> impl Iterator<Item = (K, V)> + '_
pub fn prefixes(&self) -> RTrieSet<K>
Trait Implementations§
source§impl<K: IpPrefix, V> Extend<(K, V)> for RTrieMap<K, V>
impl<K: IpPrefix, V> Extend<(K, V)> for RTrieMap<K, V>
source§fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for RTrieMap<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,
impl<K, V> Send for RTrieMap<K, V>where K: Send, V: Send,
impl<K, V> Sync for RTrieMap<K, V>where K: Sync, V: Sync,
impl<K, V> Unpin for RTrieMap<K, V>where K: Unpin, V: Unpin,
impl<K, V> UnwindSafe for RTrieMap<K, V>where K: UnwindSafe, V: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more