AllocBTreeMap

Struct AllocBTreeMap 

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

Source§

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> Freeze for AllocBTreeMap<K, V>

§

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

§

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>

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.