Skip to main content

Treap

Struct Treap 

Source
pub struct Treap<M, L, A = BoxAllocator<BstNode<TreapData<M, L>, WithParent<TreapData<M, L>>>>>
where M: MonoidAct<Key: Ord>, L: LazyMapMonoid, A: Allocator<BstNode<TreapData<M, L>, WithParent<TreapData<M, L>>>>,
{ root: Option<BstRoot<TreapSpec<M, L>>>, node_id_manager: BstNodeIdManager<TreapSpec<M, L>>, rng: Xorshift, allocator: ManuallyDrop<A>, _marker: PhantomData<(M, L)>, }

Fields§

§root: Option<BstRoot<TreapSpec<M, L>>>§node_id_manager: BstNodeIdManager<TreapSpec<M, L>>§rng: Xorshift§allocator: ManuallyDrop<A>§_marker: PhantomData<(M, L)>

Implementations§

Source§

impl<M, L> Treap<M, L>
where M: MonoidAct<Key: Ord>, L: LazyMapMonoid,

Source

pub fn new() -> Self

Source§

impl<M, L, A> Treap<M, L, A>
where M: MonoidAct<Key: Ord>, L: LazyMapMonoid, A: Allocator<BstNode<TreapData<M, L>, WithParent<TreapData<M, L>>>>,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self)

Source

pub fn get( &mut self, node_id: BstNodeId<TreapSpec<M, L>>, ) -> Option<(&M::Key, &L::Key)>

Source

pub fn change( &mut self, node_id: BstNodeId<TreapSpec<M, L>>, f: impl FnOnce(&mut L::Key), ) -> bool

Source

pub fn change_key_value( &mut self, node_id: BstNodeId<TreapSpec<M, L>>, f: impl FnOnce(&mut M::Key, &mut L::Key), ) -> bool

Source

pub fn insert( &mut self, key: M::Key, value: L::Key, ) -> BstNodeId<TreapSpec<M, L>>

Source

pub fn remove( &mut self, node_id: BstNodeId<TreapSpec<M, L>>, ) -> Option<(M::Key, L::Key)>

Source

pub fn range_by_key<Q, R>(&mut self, range: R) -> TreapSplit3<'_, M, L>
where M: MonoidAct<Key: Borrow<Q>>, Q: Ord + ?Sized, R: RangeBounds<Q>,

Source

pub fn find_by_key<Q>(&mut self, key: &Q) -> Option<BstNodeId<TreapSpec<M, L>>>
where M: MonoidAct<Key: Borrow<Q>>, Q: Ord + ?Sized,

Source

pub fn find_by_acc_cond<F>( &mut self, f: F, ) -> Option<BstNodeId<TreapSpec<M, L>>>
where F: FnMut(&L::Agg) -> bool,

Source

pub fn find_by_racc_cond<F>( &mut self, f: F, ) -> Option<BstNodeId<TreapSpec<M, L>>>
where F: FnMut(&L::Agg) -> bool,

Trait Implementations§

Source§

impl<M, L, A> Default for Treap<M, L, A>

Source§

fn default() -> Self

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

impl<M, L, A> Drop for Treap<M, L, A>
where M: MonoidAct<Key: Ord>, L: LazyMapMonoid, A: Allocator<BstNode<TreapData<M, L>, WithParent<TreapData<M, L>>>>,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<M, L, A> Freeze for Treap<M, L, A>
where A: Freeze,

§

impl<M, L, A> RefUnwindSafe for Treap<M, L, A>

§

impl<M, L, A = BoxAllocator<BstNode<TreapData<M, L>, WithParent<TreapData<M, L>>>>> !Send for Treap<M, L, A>

§

impl<M, L, A = BoxAllocator<BstNode<TreapData<M, L>, WithParent<TreapData<M, L>>>>> !Sync for Treap<M, L, A>

§

impl<M, L, A> Unpin for Treap<M, L, A>
where A: Unpin, M: Unpin, L: Unpin,

§

impl<M, L, A> UnsafeUnpin for Treap<M, L, A>
where A: UnsafeUnpin,

§

impl<M, L, A> UnwindSafe for Treap<M, L, A>

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> ToArrayVecScalar for T

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.