SinglePrefixMap

Struct SinglePrefixMap 

Source
pub struct SinglePrefixMap<T>(pub Option<T>);
Expand description

A mapping of the single prefix to a value. This essentially is a boolean value with a different interface.

Tuple Fields§

§0: Option<T>

Implementations§

Source§

impl<T> SinglePrefixMap<T>

Source

pub fn len(&self) -> usize

Return the length of the prefix map, i.e., 1 if there is a value stored for the single prefix, and 0 otheriwse.

Source

pub fn is_empty(&self) -> bool

Return wether the prefix map is empty, i.e., wether there is a value stored for the single preifx.

Trait Implementations§

Source§

impl<T: Clone> Clone for SinglePrefixMap<T>

Source§

fn clone(&self) -> SinglePrefixMap<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for SinglePrefixMap<T>

Source§

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

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

impl<T> Default for SinglePrefixMap<T>

Source§

fn default() -> Self

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

impl<'de, T> Deserialize<'de> for SinglePrefixMap<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> FromIterator<(SinglePrefix, T)> for SinglePrefixMap<T>

Source§

fn from_iter<I: IntoIterator<Item = (SinglePrefix, T)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: Hash> Hash for SinglePrefixMap<T>

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<'a, T> IntoIterator for &'a SinglePrefixMap<T>

Source§

type Item = (&'a SinglePrefix, &'a T)

The type of the elements being iterated over.
Source§

type IntoIter = Zip<Repeat<&'a SinglePrefix>, IntoIter<&'a T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for SinglePrefixMap<T>

Source§

type Item = (SinglePrefix, T)

The type of the elements being iterated over.
Source§

type IntoIter = Zip<Repeat<SinglePrefix>, IntoIter<T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: PartialEq> PartialEq for SinglePrefixMap<T>

Source§

fn eq(&self, other: &SinglePrefixMap<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<T> PrefixMap<T> for SinglePrefixMap<T>
where T: Clone + PartialEq + Debug + Serialize + for<'de> Deserialize<'de> + Send + Sync + 'static,

Source§

type P = SinglePrefix

The type of prefix
Source§

type Iter<'a> = Zip<Repeat<&'a SinglePrefix>, IntoIter<&'a T>> where Self: 'a, T: 'a

Type of Union
Source§

type Keys<'a> = RepeatN<&'a SinglePrefix> where T: 'a

The type of iterator over the keys (prefixes)
Source§

type Values<'a> = Iter<'a, T> where T: 'a

The type of iterator over immutable values.
Source§

type ValuesMut<'a> = IterMut<'a, T> where T: 'a

The type of iterator over mutable values.
Source§

type Children<'a> = <SinglePrefixMap<T> as PrefixMap<T>>::Iter<'a> where Self: 'a, T: 'a

The type of iterator over children of a given prefix.
Source§

fn iter(&self) -> Self::Iter<'_>

Iterate over references of all elements in the map.
Source§

fn keys(&self) -> Self::Keys<'_>

An iterator visiting all keys in arbitrary order. The iterator element type is &'a Self::P.
Source§

fn values(&self) -> Self::Values<'_>

An iterator visiting all values in arbitrary order. The iterator element type is &'a T.
Source§

fn values_mut(&mut self) -> Self::ValuesMut<'_>

An iterator visiting all values mutablyin arbitrary order. The iterator element type is &'a T.
Source§

fn children(&self, _prefix: &Self::P) -> Self::Children<'_>

An iterator visiting all keys and values of children of a given prefix. All children are contained within that given prefix, or are equal.
Source§

fn clear(&mut self)

Clears the map, removing all key-value pairs. Keeps the allocated memory for reuse.
Source§

fn get(&self, _: &Self::P) -> Option<&T>

Returns a reference to the value corresponding to the key.
Source§

fn get_mut(&mut self, _: &Self::P) -> Option<&mut T>

Returns a mutable reference to the value corresponding to the key.
Source§

fn get_mut_or_default(&mut self, _: Self::P) -> &mut T
where T: Default,

Returns a mutable reference to the value corresponding to the key. If the key does not exist yet, create it using a default value.
Source§

fn get_lpm(&self, k: &Self::P) -> Option<(&Self::P, &T)>

Returns a reference to the value corresponding to the longest prefix match of the key.
Source§

fn contains_key(&self, _: &Self::P) -> bool

Returns true if the map contains a value for the specified key.
Source§

fn insert(&mut self, _: Self::P, v: T) -> Option<T>

Insert a key-balue pair into the map. Read more
Source§

fn remove(&mut self, _: &Self::P) -> Option<T>

Remove a key from the map, returning a value at the key if the key was previously in the map.
Source§

impl<T> Serialize for SinglePrefixMap<T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Copy> Copy for SinglePrefixMap<T>

Source§

impl<T: Eq> Eq for SinglePrefixMap<T>

Source§

impl<T> StructuralPartialEq for SinglePrefixMap<T>

Auto Trait Implementations§

§

impl<T> Freeze for SinglePrefixMap<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SinglePrefixMap<T>
where T: RefUnwindSafe,

§

impl<T> Send for SinglePrefixMap<T>
where T: Send,

§

impl<T> Sync for SinglePrefixMap<T>
where T: Sync,

§

impl<T> Unpin for SinglePrefixMap<T>
where T: Unpin,

§

impl<T> UnwindSafe for SinglePrefixMap<T>
where T: 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'n, P, Q, Ospf, I, K, V> NetworkFormatterMap<'n, P, Q, Ospf> for I
where P: Prefix, Ospf: OspfImpl, I: IntoIterator<Item = (K, V)>, K: NetworkFormatter<'n, P, Q, Ospf>, V: NetworkFormatter<'n, P, Q, Ospf>,

Source§

fn fmt_map(self, net: &'n Network<P, Q, Ospf>) -> String

Format the map on a single line, e.g., {a: 1, b: 2}
Source§

fn fmt_map_multiline( self, net: &'n Network<P, Q, Ospf>, indent: usize, ) -> String

Format the iterator as a list, e.g., [a, b, c].
Source§

impl<'n, P, Q, Ospf, I, T> NetworkFormatterSequence<'n, P, Q, Ospf> for I
where P: Prefix, Ospf: OspfImpl, I: IntoIterator<Item = T>, T: NetworkFormatter<'n, P, Q, Ospf>,

Source§

fn fmt_set(self, net: &'n Network<P, Q, Ospf>) -> String

Format the iterator as a set, e.g., {a, b, c}.
Source§

fn fmt_set_multiline( self, net: &'n Network<P, Q, Ospf>, indent: usize, ) -> String

Format the iterator as a set over multiple lines.
Source§

fn fmt_list(self, net: &'n Network<P, Q, Ospf>) -> String

Format the iterator as a list, e.g., [a, b, c].
Source§

fn fmt_list_multiline( self, net: &'n Network<P, Q, Ospf>, indent: usize, ) -> String

Format the iterator as a milti-line list.
Source§

fn fmt_path(self, net: &'n Network<P, Q, Ospf>) -> String

Format the iterator as a path, e.g., a -> b -> c.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,