Skip to main content

Entry

Enum Entry 

Source
pub enum Entry<'a, P, Tag, K>
where P: Pointer, P::Target: AvlItem<Tag>,
{ Vacant(VacantEntry<'a, P, Tag, K>), Occupied(OccupiedEntry<'a, P, Tag>), }
Expand description

Result of a search operation in an AvlTree.

Variants§

§

Vacant(VacantEntry<'a, P, Tag, K>)

§

Occupied(OccupiedEntry<'a, P, Tag>)

Implementations§

Source§

impl<'a, P, Tag, K> Entry<'a, P, Tag, K>
where P: Pointer, P::Target: AvlItem<Tag>,

Source

pub fn unwrap_occupied(self) -> OccupiedEntry<'a, P, Tag>
where K: Debug,

Source

pub fn unwrap_vacant(self) -> VacantEntry<'a, P, Tag, K>
where P::Target: Debug,

Source

pub fn try_occupied(self) -> Option<OccupiedEntry<'a, P, Tag>>

Source

pub fn try_vacant(self) -> Option<VacantEntry<'a, P, Tag, K>>

Source§

impl<'a, P, Tag> Entry<'a, P, Tag, Last>
where P: Pointer, P::Target: AvlItem<Tag>,

Source

pub unsafe fn append_unchecked(self, node: P) -> Self

Append node to the last entry, return the new entry.

For efficient batch insert without redundant seeking to the last, only rotation will be triggered after insert.

§Safety

You have to make sure the node append in total ordering

Source

pub fn append<F>(self, node: P, cmp_f: F) -> Result<Self, P>
where F: FnOnce(&P::Target, &P::Target) -> Ordering,

Append node to the last entry with check, return the new entry.

For efficient batch insert without redundant seeking to the last, only rotation will be triggered after insert.

§Arguments:
  • node: the node to insert
  • cmp_f: compare P::Target of the entry and node. If it returns Ordering::Less, insert node and return Ok; otherwise return Err(node)
Source§

impl<'a, P, Tag> Entry<'a, P, Tag, First>
where P: Pointer, P::Target: AvlItem<Tag>,

Source

pub unsafe fn prepend_unchecked(self, node: P) -> Self

Prepend node to the first entry, return the new entry.

For efficient batch insert without redundant seeking to the first, only rotation will be triggered after insert.

§Safety

You have to make sure the node append in total ordering

Source

pub fn prepend<F>(self, node: P, cmp_f: F) -> Result<Self, P>
where F: FnOnce(&P::Target, &P::Target) -> Ordering,

Prepend node to the first entry with check, return the new entry.

For efficient batch insert without redundant seeking to the first, only rotation will be triggered after insert.

§Arguments:
  • node: the node to insert
  • cmp_f: compare P::Target of the node and entry. If it returns Ordering::Less, insert node and return Ok; otherwise return Err(node)

Trait Implementations§

Source§

impl<'a, P, Tag, K> From<Entry<'a, P, Tag, K>> for Option<OccupiedEntry<'a, P, Tag>>
where P: Pointer, P::Target: AvlItem<Tag>,

Source§

fn from(ent: Entry<'a, P, Tag, K>) -> Option<OccupiedEntry<'a, P, Tag>>

Converts to this type from the input type.
Source§

impl<'a, P, Tag, K> From<Entry<'a, P, Tag, K>> for Option<VacantEntry<'a, P, Tag, K>>
where P: Pointer, P::Target: AvlItem<Tag>,

Source§

fn from(ent: Entry<'a, P, Tag, K>) -> Option<VacantEntry<'a, P, Tag, K>>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, P, Tag, K> !Send for Entry<'a, P, Tag, K>

§

impl<'a, P, Tag, K> !Sync for Entry<'a, P, Tag, K>

§

impl<'a, P, Tag, K> !UnwindSafe for Entry<'a, P, Tag, K>

§

impl<'a, P, Tag, K> Freeze for Entry<'a, P, Tag, K>
where <P as Pointer>::Target: Sized, VacantEntry<'a, P, Tag, K>: Freeze, OccupiedEntry<'a, P, Tag>: Freeze,

§

impl<'a, P, Tag, K> RefUnwindSafe for Entry<'a, P, Tag, K>
where <P as Pointer>::Target: Sized, VacantEntry<'a, P, Tag, K>: RefUnwindSafe, OccupiedEntry<'a, P, Tag>: RefUnwindSafe,

§

impl<'a, P, Tag, K> Unpin for Entry<'a, P, Tag, K>
where <P as Pointer>::Target: Sized, VacantEntry<'a, P, Tag, K>: Unpin, OccupiedEntry<'a, P, Tag>: Unpin,

§

impl<'a, P, Tag, K> UnsafeUnpin for Entry<'a, P, Tag, K>
where <P as Pointer>::Target: Sized, VacantEntry<'a, P, Tag, K>: UnsafeUnpin, OccupiedEntry<'a, P, Tag>: UnsafeUnpin,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.