Struct OccupiedEntry

Source
pub struct OccupiedEntry<'a, T: BiHashItem, S = DefaultHashBuilder, A: Allocator = Global> { /* private fields */ }
Expand description

A view into an occupied entry in a BiHashMap. Part of the Entry enum.

Implementations§

Source§

impl<'a, T: BiHashItem, S: Clone + BuildHasher, A: Allocator> OccupiedEntry<'a, T, S, A>

Source

pub fn is_unique(&self) -> bool

Returns true if the entry is unique.

Since BiHashMap is keyed by two keys, it’s possible for OccupiedEntry to match up to two separate items. This function returns true if the entry is unique, meaning all keys point to exactly one item.

Source

pub fn is_non_unique(&self) -> bool

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

Source

pub fn get(&self) -> OccupiedEntryRef<'_, T>

Returns references to values that match the provided keys.

If you need a reference to T that may outlive the destruction of the Entry value, see into_ref.

Source

pub fn get_mut(&mut self) -> OccupiedEntryMut<'_, T, S>

Returns mutable references to values that match the provided keys.

If you need a reference to T that may outlive the destruction of the Entry value, see into_mut.

Source

pub fn into_ref(self) -> OccupiedEntryRef<'a, T>

Converts self into shared references to items that match the provided keys.

If you need multiple references to the OccupiedEntry, see get.

Source

pub fn into_mut(self) -> OccupiedEntryMut<'a, T, S>

Converts self into mutable references to items that match the provided keys.

If you need multiple references to the OccupiedEntry, see get_mut.

Source

pub fn insert(&mut self, value: T) -> Vec<T>

Sets the entry to a new value, returning all values that conflict.

§Panics

Panics if the passed-in key is different from the key of the entry.

Source

pub fn remove(self) -> Vec<T>

Takes ownership of the values from the map.

Trait Implementations§

Source§

impl<'a, T: BiHashItem, S, A: Allocator> Debug for OccupiedEntry<'a, T, S, A>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T, S, A> Freeze for OccupiedEntry<'a, T, S, A>

§

impl<'a, T, S, A> RefUnwindSafe for OccupiedEntry<'a, T, S, A>

§

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

§

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

§

impl<'a, T, S, A> Unpin for OccupiedEntry<'a, T, S, A>

§

impl<'a, T, S = RandomState, A = Global> !UnwindSafe for OccupiedEntry<'a, T, S, A>

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.