Struct RbTreeMap

Source
pub struct RbTreeMap<K, V, A>
where A: Allocator,
{ /* private fields */ }
Expand description

A map type based on the ngx_rbtree_t.

This map implementation owns the stored keys and values and ensures that the data is dropped. The order of the elements is an undocumented implementation detail.

This is a ngx-specific high-level type with no direct counterpart in the NGINX code.

Implementations§

Source§

impl<K, V, A> RbTreeMap<K, V, A>
where A: Allocator,

Source

pub fn allocator(&self) -> &A

Returns a reference to the underlying allocator.

Source

pub fn clear(&mut self)

Clears the tree, removing all elements.

Source

pub fn is_empty(&self) -> bool

Returns true if the tree contains no entries.

Source

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

Returns an iterator over the entries of the tree.

Source

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

Returns a mutable iterator over the entries of the tree.

Source§

impl<K, V, A> RbTreeMap<K, V, A>
where A: Allocator, K: Hash + Ord,

Source

pub fn try_new_in(alloc: A) -> Result<Self, AllocError>

Attempts to create and initialize a new RbTreeMap with specified allocator.

Source

pub fn get<Q>(&self, key: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Hash + Ord + ?Sized,

Returns a reference to the value corresponding to the key.

Source

pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
where K: Borrow<Q>, Q: Hash + Ord + ?Sized,

Returns a mutable reference to the value corresponding to the key.

Source

pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
where K: Borrow<Q>, Q: Hash + Ord + ?Sized,

Removes a key from the tree, returning the value at the key if the key was previously in the tree.

Source

pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
where K: Borrow<Q>, Q: Hash + Ord + ?Sized,

Removes a key from the tree, returning the stored key and value if the key was previously in the tree.

Source

pub fn try_insert(&mut self, key: K, value: V) -> Result<&mut V, AllocError>

Attempts to insert a new element into the tree.

Trait Implementations§

Source§

impl<K: Debug, V: Debug, A> Debug for RbTreeMap<K, V, A>
where A: Allocator + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V, A> Drop for RbTreeMap<K, V, A>
where A: Allocator,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<K, V, A> Send for RbTreeMap<K, V, A>
where A: Send + Allocator, K: Send, V: Send,

Source§

impl<K, V, A> Sync for RbTreeMap<K, V, A>
where A: Sync + Allocator, K: Sync, V: Sync,

Auto Trait Implementations§

§

impl<K, V, A> Freeze for RbTreeMap<K, V, A>
where A: Freeze,

§

impl<K, V, A> RefUnwindSafe for RbTreeMap<K, V, A>

§

impl<K, V, A> Unpin for RbTreeMap<K, V, A>
where A: Unpin, K: Unpin, V: Unpin,

§

impl<K, V, A> UnwindSafe for RbTreeMap<K, V, A>
where A: UnwindSafe, 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, 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.