Enum Entry
pub enum Entry<'a, T, A: Allocator + Clone = Global>
A view into a single entry in a set, which may either be vacant or occupied.
This enum is constructed from the entry method on BTreeSet.
Examples
use BTreeSet;
let mut set = new;
set.extend;
assert_eq!;
// Existing value (insert)
let entry = set.entry;
let _raw_o = entry.insert;
assert_eq!;
// Nonexistent value (insert)
set.entry.insert;
// Existing value (or_insert)
set.entry.or_insert;
// Nonexistent value (or_insert)
set.entry.or_insert;
println!;
assert!;
Variants
-
Occupied(OccupiedEntry<'a, T, A>) An occupied entry.
Examples
use ; let mut set = from; match set.entry-
Vacant(VacantEntry<'a, T, A>) A vacant entry.
Examples
use ; let mut set = new; match set.entry
Implementations
impl<'a, T: Ord, A: Allocator + Clone> Entry<'a, T, A>
fn insert(self) -> OccupiedEntry<'a, T, A>Sets the value of the entry, and returns an
OccupiedEntry.Examples
use BTreeSet; let mut set = new; let entry = set.entry.insert; assert_eq!;fn or_insert(self)Ensures a value is in the entry by inserting if it was vacant.
Examples
use BTreeSet; let mut set = new; // nonexistent key set.entry.or_insert; assert!; // existing key set.entry.or_insert; assert!; assert_eq!;fn get(&self) -> &TReturns a reference to this entry's value.
Examples
use BTreeSet; let mut set = new; set.entry.or_insert; // existing key assert_eq!; // nonexistent key assert_eq!;
Trait Implementations
impl<T: Debug + Ord, A: Allocator + Clone> Debug for Entry<'_, T, A>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<'a, T, A = Global> !UnwindSafe for Entry<'a, T, A>
impl<'a, T, A> Freeze for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Freeze,
VacantEntry<'a, T, A>: Freeze,
impl<'a, T, A> RefUnwindSafe for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: RefUnwindSafe,
VacantEntry<'a, T, A>: RefUnwindSafe,
impl<'a, T, A> Send for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Send,
VacantEntry<'a, T, A>: Send,
impl<'a, T, A> Sync for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Sync,
VacantEntry<'a, T, A>: Sync,
impl<'a, T, A> Unpin for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: Unpin,
VacantEntry<'a, T, A>: Unpin,
impl<'a, T, A> UnsafeUnpin for Entry<'a, T, A>
where
OccupiedEntry<'a, T, A>: UnsafeUnpin,
VacantEntry<'a, T, A>: UnsafeUnpin,
Blanket Implementations
impl<T> Any for Entry<'a, T, A>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Entry<'a, T, A>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Entry<'a, T, A>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Entry<'a, T, A>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Entry<'a, T, A>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Entry<'a, T, A>
impl<T, U> Into<U> for Entry<'a, T, A>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Entry<'a, T, A>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Entry<'a, T, A>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>