Split

pub struct Split<'a, Spec>
where Spec: BstSpec,
{ left: Option<BstRoot<Spec>>, right: Option<BstRoot<Spec>>, root: &'a mut Option<BstRoot<Spec>>, }

Fields§

§left: Option<BstRoot<Spec>>§right: Option<BstRoot<Spec>>§root: &'a mut Option<BstRoot<Spec>>

Implementations§

Source§

impl<'a, Spec> Split<'a, Spec>
where Spec: BstSpec,

Source

pub fn new<Seek>( node: &'a mut Option<BstRoot<Spec>>, seeker: Seek, eq_left: bool, ) -> Self
where Seek: BstSeeker<Spec = Spec>,

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (lines 421-425)
416    pub fn find_by_key<Q>(&mut self, key: &Q) -> Option<BstNodeId<TreapSpec<M, L>>>
417    where
418        M: MonoidAct<Key: Borrow<Q>>,
419        Q: Ord + ?Sized,
420    {
421        let split = Split::new(
422            &mut self.root,
423            SeekByKey::<TreapSpec<M, L>, M::Key, Q>::new(key),
424            false,
425        );
426        let node = split.right()?.leftmost()?;
427        matches!(node.into_data().key.key.borrow().cmp(key), Ordering::Equal)
428            .then(|| self.node_id_manager.registerd_node_id(node))
429            .flatten()
430    }
431
432    pub fn find_by_acc_cond<F>(&mut self, f: F) -> Option<BstNodeId<TreapSpec<M, L>>>
433    where
434        F: FnMut(&L::Agg) -> bool,
435    {
436        let split = Split::new(
437            &mut self.root,
438            SeekByAccCond::<TreapSpec<M, L>, L, F>::new(f),
439            false,
440        );
441        let node = split.right()?.leftmost()?;
442        self.node_id_manager.registerd_node_id(node)
443    }
444
445    pub fn find_by_racc_cond<F>(&mut self, f: F) -> Option<BstNodeId<TreapSpec<M, L>>>
446    where
447        F: FnMut(&L::Agg) -> bool,
448    {
449        let split = Split::new(
450            &mut self.root,
451            SeekByRaccCond::<TreapSpec<M, L>, L, F>::new(f),
452            true,
453        );
454        let node = split.left()?.rightmost()?;
455        self.node_id_manager.registerd_node_id(node)
456    }
Source

pub fn left(&self) -> Option<BstImmutRef<'_, Spec>>

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 454)
445    pub fn find_by_racc_cond<F>(&mut self, f: F) -> Option<BstNodeId<TreapSpec<M, L>>>
446    where
447        F: FnMut(&L::Agg) -> bool,
448    {
449        let split = Split::new(
450            &mut self.root,
451            SeekByRaccCond::<TreapSpec<M, L>, L, F>::new(f),
452            true,
453        );
454        let node = split.left()?.rightmost()?;
455        self.node_id_manager.registerd_node_id(node)
456    }
Source

pub fn right(&self) -> Option<BstImmutRef<'_, Spec>>

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 426)
416    pub fn find_by_key<Q>(&mut self, key: &Q) -> Option<BstNodeId<TreapSpec<M, L>>>
417    where
418        M: MonoidAct<Key: Borrow<Q>>,
419        Q: Ord + ?Sized,
420    {
421        let split = Split::new(
422            &mut self.root,
423            SeekByKey::<TreapSpec<M, L>, M::Key, Q>::new(key),
424            false,
425        );
426        let node = split.right()?.leftmost()?;
427        matches!(node.into_data().key.key.borrow().cmp(key), Ordering::Equal)
428            .then(|| self.node_id_manager.registerd_node_id(node))
429            .flatten()
430    }
431
432    pub fn find_by_acc_cond<F>(&mut self, f: F) -> Option<BstNodeId<TreapSpec<M, L>>>
433    where
434        F: FnMut(&L::Agg) -> bool,
435    {
436        let split = Split::new(
437            &mut self.root,
438            SeekByAccCond::<TreapSpec<M, L>, L, F>::new(f),
439            false,
440        );
441        let node = split.right()?.leftmost()?;
442        self.node_id_manager.registerd_node_id(node)
443    }
Source

pub fn left_datamut(&mut self) -> Option<BstDataMutRef<'_, Spec>>

Source

pub fn right_datamut(&mut self) -> Option<BstDataMutRef<'_, Spec>>

Source

pub fn manually_merge<F>(&mut self, f: F)
where F: FnMut(Option<BstRoot<Spec>>, Option<BstRoot<Spec>>) -> Option<BstRoot<Spec>>,

Trait Implementations§

Source§

impl<'a, Spec> Drop for Split<'a, Spec>
where Spec: BstSpec,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, Spec> Freeze for Split<'a, Spec>

§

impl<'a, Spec> RefUnwindSafe for Split<'a, Spec>
where <Spec as BstSpec>::Data: RefUnwindSafe, <Spec as BstSpec>::Parent: RefUnwindSafe,

§

impl<'a, Spec> !Send for Split<'a, Spec>

§

impl<'a, Spec> !Sync for Split<'a, Spec>

§

impl<'a, Spec> Unpin for Split<'a, Spec>

§

impl<'a, Spec> !UnwindSafe for Split<'a, Spec>

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.