Skip to main content

TryBTreeMap

Struct TryBTreeMap 

Source
pub struct TryBTreeMap<K, V>
where K: Copy,
{ /* private fields */ }
Expand description

Like std::collections::BTreeMap but its methods return errors on allocation failure.

Implementations§

Source§

impl<K, V> TryBTreeMap<K, V>
where K: Copy,

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains_key(&self, key: K) -> bool
where K: Ord,

Source

pub fn get(&self, key: K) -> Option<&V>
where K: Ord,

Source

pub fn get_mut(&mut self, key: K) -> Option<&mut V>
where K: Ord,

Source

pub fn insert(&mut self, key: K, value: V) -> Result<Option<V>, OutOfMemory>
where K: Ord,

Same as std::collections::BTreeMap::insert but returns an error on allocation failure.

Source

pub fn remove(&mut self, key: K) -> Option<V>
where K: Ord,

Source

pub fn clear(&mut self)

Same as std::collections::BTreeMap::clear.

Does not deallocate the underlying storage.

Source

pub fn iter(&self) -> BTreeMapIter<'_, K, V>

Source

pub fn iter_mut(&mut self) -> BTreeMapIterMut<'_, K, V>

Source

pub fn keys(&self) -> BTreeMapKeys<'_, K, V>

Source

pub fn values(&self) -> BTreeMapValues<'_, K, V>

Source

pub fn values_mut(&mut self) -> BTreeMapValuesMut<'_, K, V>

Source

pub fn range<R>(&self, range: R) -> BTreeMapRange<'_, K, V, R>
where K: Ord, R: RangeBounds<K>,

Source

pub fn range_mut<R>(&mut self, range: R) -> BTreeMapRangeMut<'_, K, V, R>
where K: Ord, R: RangeBounds<K>,

Source

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

Trait Implementations§

Source§

impl<K, V> Default for TryBTreeMap<K, V>
where K: Copy,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, K, V> IntoIterator for &'a TryBTreeMap<K, V>
where K: Copy,

Source§

type Item = (K, &'a V)

The type of the elements being iterated over.
Source§

type IntoIter = BTreeMapIter<'a, K, V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, K, V> IntoIterator for &'a mut TryBTreeMap<K, V>
where K: Copy,

Source§

type Item = (K, &'a mut V)

The type of the elements being iterated over.
Source§

type IntoIter = BTreeMapIterMut<'a, K, V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<K, V> IntoIterator for TryBTreeMap<K, V>
where K: Copy + Ord,

Source§

type Item = (K, V)

The type of the elements being iterated over.
Source§

type IntoIter = BTreeMapIntoIter<K, V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<K, V> Freeze for TryBTreeMap<K, V>

§

impl<K, V> RefUnwindSafe for TryBTreeMap<K, V>

§

impl<K, V> Send for TryBTreeMap<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for TryBTreeMap<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for TryBTreeMap<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for TryBTreeMap<K, V>
where K: UnwindSafe, V: 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> Same for T

Source§

type Output = T

Should always be Self
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.