Struct matrix_appservice_rs::MappingDict [−][src]
pub struct MappingDict<V: Mappable> { /* fields omitted */ }
Expand description
A map comparable to a HashMap
which contains items that are Mappable
.
The map keeps track of the mapping between both the external type and Matrix type and an
object.
Implementations
impl<V> MappingDict<V> where
V: Mappable,
[src]
impl<V> MappingDict<V> where
V: Mappable,
[src]pub fn from_vec(items: Vec<V>) -> Self
[src]
pub fn from_vec(items: Vec<V>) -> Self
[src]Create a new MappingDict
consuming the given Vec
of items.
All items are put into the newly created map.
This is more efficient than just calling insert
yourself on an empty map, since this
method will initialize the vector and hashmap with a starting capacpity, thus resulting in
less allocations.
pub fn insert(&mut self, item: V) -> &mut V
[src]
pub fn insert(&mut self, item: V) -> &mut V
[src]Inserts the given item
in the current MappingDict
.
Allocates if neccesary.
Returns a mutable reference to the newly inserted item.
pub fn get(
&self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> Option<&V>
[src]
pub fn get(
&self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> Option<&V>
[src]Returns a reference to the item associated with the given identifier
, or None
if no
such item exists.
pub fn get_mut(
&mut self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> Option<&mut V>
[src]
pub fn get_mut(
&mut self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> Option<&mut V>
[src]Returns a mutable reference to the item associated with the given identifier
, or None
if no such item exists.
pub fn has(
&self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> bool
[src]
pub fn has(
&self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> bool
[src]Returns whether or not this MappingDict
contains an item associated with the given
identifier
.
pub fn remove(
&mut self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> Option<V>
[src]
pub fn remove(
&mut self,
identifier: MappingId<'_, V::ExternalReference, V::MatrixReference>
) -> Option<V>
[src]If this MappingDict
contains an item associated with the given identifier
, remove it
and return the value that was contained in the MappingDict
.
If no such item exists, this function returns None
.
pub fn iter(&self) -> Iter<'_, V>
[src]
pub fn iter(&self) -> Iter<'_, V>
[src]Get an iterator over references of the items contained in this MappingDict
.
pub fn iter_mut(&mut self) -> IterMut<'_, V>
[src]
pub fn iter_mut(&mut self) -> IterMut<'_, V>
[src]Get an iterator over mutable references of the items contained in this MappingDict
.
pub fn shrink_to_fit(&mut self)
[src]
pub fn shrink_to_fit(&mut self)
[src]Shrinks the capacity of the map as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
Trait Implementations
impl<V: Clone + Mappable> Clone for MappingDict<V> where
V::ExternalType: Clone,
V::MatrixType: Clone,
[src]
impl<V: Clone + Mappable> Clone for MappingDict<V> where
V::ExternalType: Clone,
V::MatrixType: Clone,
[src]fn clone(&self) -> MappingDict<V>
[src]
fn clone(&self) -> MappingDict<V>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<V: Debug + Mappable> Debug for MappingDict<V> where
V::ExternalType: Debug,
V::MatrixType: Debug,
[src]
impl<V: Debug + Mappable> Debug for MappingDict<V> where
V::ExternalType: Debug,
V::MatrixType: Debug,
[src]impl<T: Mappable> Default for MappingDict<T>
[src]
impl<T: Mappable> Default for MappingDict<T>
[src]impl<'a, T> IntoIterator for &'a MappingDict<T> where
T: Mappable,
[src]
impl<'a, T> IntoIterator for &'a MappingDict<T> where
T: Mappable,
[src]Auto Trait Implementations
impl<V> RefUnwindSafe for MappingDict<V> where
V: RefUnwindSafe,
<V as Mappable>::ExternalType: RefUnwindSafe,
<V as Mappable>::MatrixType: RefUnwindSafe,
V: RefUnwindSafe,
<V as Mappable>::ExternalType: RefUnwindSafe,
<V as Mappable>::MatrixType: RefUnwindSafe,
impl<V> Send for MappingDict<V> where
V: Send,
<V as Mappable>::ExternalType: Send,
<V as Mappable>::MatrixType: Send,
V: Send,
<V as Mappable>::ExternalType: Send,
<V as Mappable>::MatrixType: Send,
impl<V> Sync for MappingDict<V> where
V: Sync,
<V as Mappable>::ExternalType: Sync,
<V as Mappable>::MatrixType: Sync,
V: Sync,
<V as Mappable>::ExternalType: Sync,
<V as Mappable>::MatrixType: Sync,
impl<V> Unpin for MappingDict<V> where
V: Unpin,
<V as Mappable>::ExternalType: Unpin,
<V as Mappable>::MatrixType: Unpin,
V: Unpin,
<V as Mappable>::ExternalType: Unpin,
<V as Mappable>::MatrixType: Unpin,
impl<V> UnwindSafe for MappingDict<V> where
V: UnwindSafe,
<V as Mappable>::ExternalType: UnwindSafe,
<V as Mappable>::MatrixType: UnwindSafe,
V: UnwindSafe,
<V as Mappable>::ExternalType: UnwindSafe,
<V as Mappable>::MatrixType: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more