Struct EdgeHashMap

Source
pub struct EdgeHashMap<'a, M: Manager, V, S> { /* private fields */ }
Expand description

HashMap mapping from edges to values of type V

Internally, this map stores a Manager reference such that it can clone or drop edges accordingly. There is no need to manually drop all contained keys before dropping the map.

Implementations§

Source§

impl<'a, M: Manager, V, S: Default + BuildHasher> EdgeHashMap<'a, M, V, S>

Source

pub fn new(manager: &'a M) -> Self

Create a new edge map

Source

pub fn with_capacity(manager: &'a M, capacity: usize) -> Self

Create a new edge map with capacity

Source

pub fn len(&self) -> usize

Returns the number of elements in the map

Source

pub fn is_empty(&self) -> bool

Returns true iff the map has no elements

Source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements

The collection may reserve more space to speculatively avoid frequent reallocations. After calling reserve(), the capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.

§Panics

Panics if the new allocation size overflows usize.

Source

pub fn get(&self, key: &M::Edge) -> Option<&V>

Get a reference to the value for edge (if present)

Source

pub fn get_mut(&mut self, key: &M::Edge) -> Option<&mut V>

Get a mutable reference to the value for edge (if present)

Source

pub fn insert(&mut self, key: &M::Edge, value: V) -> Option<V>

Insert a key-value pair into the map

If the map did not have this key present, the key is cloned, and None is returned. If the map did have this key present, the value is updated, and the old value is returned.

Source

pub fn remove(&mut self, key: &M::Edge) -> Option<V>

Remove the entry for the given key (if present)

Returns the value that was previously stored in the map, or None, respectively.

Source

pub fn iter(&self) -> Iter<'_, M, V>

Iterator visiting all key-value pairs in arbitrary order

The item type is (&M::Edge, &V).

Source

pub fn iter_mut(&mut self) -> IterMut<'_, M, V>

Mutable iterator visiting all key-value pairs in arbitrary order

The item type is (&M::Edge, &mut V).

Trait Implementations§

Source§

impl<'a, M: Manager, V: Clone, S: Default + BuildHasher> Clone for EdgeHashMap<'a, M, V, S>

Source§

fn clone(&self) -> Self

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<'a, M: Manager, V, S> Drop for EdgeHashMap<'a, M, V, S>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a, 'b, M: Manager, V, S> IntoIterator for &'b EdgeHashMap<'a, M, V, S>

Source§

type Item = (&'b <M as Manager>::Edge, &'b V)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'b, M, V>

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<'a, 'b, M: Manager, V, S> IntoIterator for &'b mut EdgeHashMap<'a, M, V, S>

Source§

type Item = (&'b <M as Manager>::Edge, &'b mut V)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'b, M, V>

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<'a, M: Manager, V, S> IntoIterator for EdgeHashMap<'a, M, V, S>

Source§

type Item = (<M as Manager>::Edge, V)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<M, V>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<'a, M, V, S> Freeze for EdgeHashMap<'a, M, V, S>
where S: Freeze,

§

impl<'a, M, V, S> RefUnwindSafe for EdgeHashMap<'a, M, V, S>

§

impl<'a, M, V, S> Send for EdgeHashMap<'a, M, V, S>
where M: Sync, S: Send, V: Send, <M as Manager>::Edge: Send,

§

impl<'a, M, V, S> Sync for EdgeHashMap<'a, M, V, S>
where M: Sync, S: Sync, V: Sync, <M as Manager>::Edge: Sync,

§

impl<'a, M, V, S> Unpin for EdgeHashMap<'a, M, V, S>
where S: Unpin, V: Unpin, <M as Manager>::Edge: Unpin,

§

impl<'a, M, V, S> UnwindSafe for EdgeHashMap<'a, M, V, S>

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> 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.