Struct Writeable

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

RAII structure used to release the exclusive write access, when dropped.

Implementations§

Source§

impl<K: Eq + Hash, V, S: BuildHasher> Writeable<'_, K, V, S>

Source

pub fn get(&self) -> Option<&V>

Returns a reference to the value corresponding to the key.

Source

pub fn get_key_value(&self) -> Option<(&K, &V)>

Returns the key-value pair corresponding to the supplied key.

Source

pub fn contains_key(&self) -> bool

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

Source

pub fn get_mut(&mut self) -> Option<&mut V>

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

Source

pub fn insert(self, value: V) -> Option<V>

Inserts a key-value pair into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the value is updated, and the old value is returned. The key is not updated, though; this matters for types that can be == without being identical.

Source

pub fn remove(&mut self) -> Option<V>

Removes a key from the map, returning the value at the key if the key was previously in the map.

Source

pub fn entry(&mut self) -> Entry<'_, K, V>
where K: Clone,

Gets the given key’s corresponding entry in the map for in-place manipulation.

Source

pub fn remove_entry(&mut self) -> Option<(K, V)>

Removes a key from the map, returning the stored key and value if the key was previously in the map.

Trait Implementations§

Source§

impl<'a, K: Debug, V: Debug, S: Debug> Debug for Writeable<'a, K, V, S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, K, V, S> Freeze for Writeable<'a, K, V, S>
where K: Freeze,

§

impl<'a, K, V, S> RefUnwindSafe for Writeable<'a, K, V, S>
where K: RefUnwindSafe,

§

impl<'a, K, V, S> !Send for Writeable<'a, K, V, S>

§

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

§

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

§

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