Struct hashbag::Entry

source ·
pub struct Entry<'a, T, S>(/* private fields */);
Expand description

A view into a single entry in the bag, which may either be vacant or occupied. This enum is constructed from the entry method on HashBag

Implementations§

source§

impl<'a, T, S> Entry<'a, T, S>
where T: Hash + Eq, S: BuildHasher,

source

pub fn and_modify<F>(self, f: F) -> Self
where F: FnOnce(&mut usize),

Provides in-place mutable access to an occupied entry before potential inserts into the map.

source

pub fn value(&self) -> &T

Returns a reference to the entry’s value.

source

pub fn or_insert(self) -> usize

Ensures there is at least one instance of the value before returning a mutable reference to the value’s count

source

pub fn or_insert_many(self, quantity: usize) -> usize

Ensures there is at least quantity instances of the value before returning a mutable reference to the value’s count

Trait Implementations§

source§

impl<'a, T: Debug, S: Debug> Debug for Entry<'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> RefUnwindSafe for Entry<'a, T, S>

§

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

§

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

§

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

§

impl<'a, T, S> !UnwindSafe for Entry<'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>,

§

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>,

§

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.