Skip to main content

MutableMap

Struct MutableMap 

Source
pub struct MutableMap<'a, K, V> { /* private fields */ }
Expand description

An owned mutable map with dirty tracking and ProtoCache key encoding.

Implementations§

Source§

impl<'a, K: Eq + Hash, V> MutableMap<'a, K, V>

Source

pub fn new() -> Self

Creates an empty, clean mutable map.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self)

Removes all entries and marks the map dirty.

Source

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

Source

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

Inserts an entry and marks the map dirty.

Source

pub fn contains_key<Q>(&self, key: &Q) -> bool
where K: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn get<Q>(&self, key: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
where K: Borrow<Q>, Q: Eq + Hash + ?Sized,

Returns mutable access to a value and marks the map dirty when found.

Source

pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
where K: Borrow<Q>, Q: Eq + Hash + ?Sized,

Source

pub fn iter(&self) -> impl Iterator<Item = (&K, &V)>

Source§

impl<'a, K: MutableMapKey<'a>, V: MutableField<'a>> MutableMap<'a, K, V>

Source

pub fn from_words(words: &'a [u32]) -> Option<Self>

Decodes all entries from an encoded map.

Source

pub fn encode_to_unit(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Encodes the map and its perfect-hash index into buffer.

Trait Implementations§

Source§

impl<'a, K: Clone, V: Clone> Clone for MutableMap<'a, K, V>

Source§

fn clone(&self) -> MutableMap<'a, K, V>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, K: Debug, V: Debug> Debug for MutableMap<'a, K, V>

Source§

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

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

impl<'a, K, V> Default for MutableMap<'a, K, V>

Source§

fn default() -> Self

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

impl<'a, K: Eq + Hash, V> Extend<(K, V)> for MutableMap<'a, K, V>

Source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

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
Source§

impl<'a, K, V> From<HashMap<K, V>> for MutableMap<'a, K, V>

Source§

fn from(entries: HashMap<K, V>) -> Self

Converts to this type from the input type.
Source§

impl<'a, K: Eq + Hash, V> FromIterator<(K, V)> for MutableMap<'a, K, V>

Source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'b, 'a, K, V> IntoIterator for &'b MutableMap<'a, K, V>

Source§

type Item = (&'b K, &'b V)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'b, K, 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<'b, 'a, K, V> IntoIterator for &'b mut MutableMap<'a, K, V>

Source§

type Item = (&'b K, &'b mut V)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'b, K, 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, K: MutableMapKey<'a>, V: MutableField<'a>> MutableArrayElement<'a> for MutableMap<'a, K, V>

Source§

fn decode_array(words: &'a [u32]) -> Option<Vec<Self>>

Source§

fn encode_array( values: &[Self], buffer: &mut Buffer, ) -> Result<Unit, MutableError>

Source§

fn detect_array_words(words: &'a [u32]) -> Option<&'a [u32]>

Source§

fn detect_array_field(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

impl<'a, K: MutableMapKey<'a>, V: MutableField<'a>> MutableField<'a> for MutableMap<'a, K, V>

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn encode(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn is_dirty(&self) -> bool

Source§

fn has_nested_dirty(&self) -> bool

Source§

fn folds_when_present() -> bool
where Self: Sized,

Auto Trait Implementations§

§

impl<'a, K, V> Freeze for MutableMap<'a, K, V>

§

impl<'a, K, V> RefUnwindSafe for MutableMap<'a, K, V>

§

impl<'a, K, V> Send for MutableMap<'a, K, V>
where K: Send, V: Send,

§

impl<'a, K, V> Sync for MutableMap<'a, K, V>
where K: Sync, V: Sync,

§

impl<'a, K, V> Unpin for MutableMap<'a, K, V>
where K: Unpin, V: Unpin,

§

impl<'a, K, V> UnsafeUnpin for MutableMap<'a, K, V>

§

impl<'a, K, V> UnwindSafe for MutableMap<'a, K, V>
where K: UnwindSafe, V: 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<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.