Enum OccupiedEntryMut

Source
pub enum OccupiedEntryMut<'a, T: BiHashItem, S: Clone + BuildHasher = DefaultHashBuilder> {
    Unique(RefMut<'a, T, S>),
    NonUnique {
        by_key1: Option<RefMut<'a, T, S>>,
        by_key2: Option<RefMut<'a, T, S>>,
    },
}
Expand description

A mutable view into an occupied entry in a BiHashMap.

Returned by OccupiedEntry::get_mut.

Variants§

§

Unique(RefMut<'a, T, S>)

All keys point to the same entry.

§

NonUnique

The keys point to different entries, or some keys are not present.

Fields

§by_key1: Option<RefMut<'a, T, S>>

The value fetched by the first key.

§by_key2: Option<RefMut<'a, T, S>>

The value fetched by the second key.

Implementations§

Source§

impl<'a, T: BiHashItem, S: Clone + BuildHasher> OccupiedEntryMut<'a, T, S>

Source

pub fn is_unique(&self) -> bool

Returns true if the entry is unique.

Source

pub fn is_non_unique(&self) -> bool

Returns true if the OccupiedEntryMut represents more than one item, or if some keys are not present.

Source

pub fn as_unique(&mut self) -> Option<RefMut<'_, T, S>>

Returns a reference to the value if it is unique.

Source

pub fn by_key1(&mut self) -> Option<RefMut<'_, T, S>>

Returns a mutable reference to the value fetched by the first key.

Source

pub fn by_key2(&mut self) -> Option<RefMut<'_, T, S>>

Returns a mutable reference to the value fetched by the second key.

Source

pub fn for_each<F>(&mut self, f: F)
where F: FnMut(RefMut<'_, T, S>),

Calls a callback for each value.

Trait Implementations§

Source§

impl<'a, T: BiHashItem + Debug, S: Clone + BuildHasher> Debug for OccupiedEntryMut<'a, T, S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T, S> Freeze for OccupiedEntryMut<'a, T, S>
where S: Freeze,

§

impl<'a, T, S> RefUnwindSafe for OccupiedEntryMut<'a, T, S>

§

impl<'a, T, S> Send for OccupiedEntryMut<'a, T, S>
where T: Send, S: Send,

§

impl<'a, T, S> Sync for OccupiedEntryMut<'a, T, S>
where T: Sync, S: Sync,

§

impl<'a, T, S> Unpin for OccupiedEntryMut<'a, T, S>
where S: Unpin,

§

impl<'a, T, S = RandomState> !UnwindSafe for OccupiedEntryMut<'a, T, 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> 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.