pub struct AllocBTreeMap<K, V> { /* private fields */ }
Expand description

A Map implementation based on alloc::collections::BTreeMap.

Implementations§

source§

impl<K, V> AllocBTreeMap<K, V>

source

pub fn with_btree_map(btree_map: BTreeMap<K, V>) -> Self

Creates a new AllocBTreeMap with the given BTreeMap.

source

pub fn new() -> Self

Creates a new empty AllocBTreeMap.

Trait Implementations§

source§

impl<K, V> Default for AllocBTreeMap<K, V>

source§

fn default() -> Self

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

impl<K: Ord, V> Map<K, V> for AllocBTreeMap<K, V>

§

type Error = Infallible

Associated error type.
source§

fn insert(&mut self, key: K, value: V) -> Result<Option<V>, Self::Error>

Inserts a new key/value pair into this map.
source§

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

Returns an immutable reference to the value associated with the given key.
source§

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

Returns a mutable reference to the value associated with the given key.
source§

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

Removes the key/value pair associated with the given key from this map.
source§

fn clear(&mut self) -> Result<(), Self::Error>

Removes all key/value pairs stored in this map.
source§

fn is_empty(&self) -> bool

Returns whether this map is empty.
source§

fn capacity(&self) -> Option<usize>

Returns the number of key/value pairs this map is capable of storing.
source§

fn len(&self) -> usize

Rethrns the number of key/value pairs currently stored in this map.

Auto Trait Implementations§

§

impl<K, V> RefUnwindSafe for AllocBTreeMap<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,

§

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

§

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

§

impl<K, V> Unpin for AllocBTreeMap<K, V>

§

impl<K, V> UnwindSafe for AllocBTreeMap<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.