Struct NgxRbTree

Source
pub struct NgxRbTree<T> { /* private fields */ }
Expand description

A wrapper over a raw ngx_rbtree_t, a red-black tree implementation.

This wrapper is defined in terms of type T that embeds and can be converted from or to the tree nodes.

See https://nginx.org/en/docs/dev/development_guide.html#red_black_tree.

Implementations§

Source§

impl<T> NgxRbTree<T>
where T: NgxRbTreeEntry,

Source

pub unsafe fn from_ptr<'a>(tree: *const ngx_rbtree_t) -> &'a Self

Creates a tree reference from a pointer to ngx_rbtree_t.

§Safety

tree is a valid pointer to ngx_rbtree_t, and T::from_rbtree_node on the tree nodes results in valid pointers to T.

Source

pub unsafe fn from_ptr_mut<'a>(tree: *mut ngx_rbtree_t) -> &'a mut Self

Creates a mutable tree reference from a pointer to ngx_rbtree_t.

§Safety

tree is a valid pointer to ngx_rbtree_t, and T::from_rbtree_node on the tree nodes results in valid pointers to T.

Source

pub fn is_empty(&self) -> bool

Returns true if the tree contains no elements.

Source

pub fn insert(&mut self, node: &mut T)

Appends a node to the tree.

Source

pub fn remove(&mut self, node: &mut T)

Removes the specified node from the tree.

Source

pub fn iter(&self) -> NgxRbTreeIter<'_>

Returns an iterator over the nodes of the tree.

Source

pub fn iter_mut(&mut self) -> NgxRbTreeIter<'_>

Returns a mutable iterator over the nodes of the tree.

Trait Implementations§

Source§

impl<T: Debug> Debug for NgxRbTree<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for NgxRbTree<T>

§

impl<T> RefUnwindSafe for NgxRbTree<T>
where T: RefUnwindSafe,

§

impl<T> !Send for NgxRbTree<T>

§

impl<T> !Sync for NgxRbTree<T>

§

impl<T> Unpin for NgxRbTree<T>
where T: Unpin,

§

impl<T> UnwindSafe for NgxRbTree<T>
where T: 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.