Skip to main content

PathLinkCutTreeSpec

Struct PathLinkCutTreeSpec 

Source
pub struct PathLinkCutTreeSpec<L>(PhantomData<fn() -> L>);

Tuple Fields§

§0: PhantomData<fn() -> L>

Implementations§

Source§

impl<L> PathLinkCutTreeSpec<L>
where L: LazyMapMonoid,

Source

fn apply_non_unit(data: &mut PathLinkCutTreeData<L>, action: &L::Act)

Examples found in repository?
crates/competitive/src/tree/link_cut_tree.rs (line 476)
470    fn top_down(data: &mut Self::Data, children: [Option<&mut Self::Data>; 2]) {
471        if L::is_act_unit(&data.value.act) {
472            return;
473        }
474        let action = replace(&mut data.value.act, L::act_unit());
475        for child in children.into_iter().flatten() {
476            Self::apply_non_unit(child, &action);
477        }
478    }
479
480    fn bottom_up(data: &mut Self::Data, children: [Option<&Self::Data>; 2]) {
481        let mut aggregate = L::single_agg(&data.value.key);
482        if let Some(left) = children[0] {
483            aggregate = L::agg_operate(&left.value.agg, &aggregate);
484        }
485        if let Some(right) = children[1] {
486            aggregate = L::agg_operate(&aggregate, &right.value.agg);
487        }
488        data.value.agg = aggregate;
489    }
490
491    fn reverse(data: &mut Self::Data) {
492        L::toggle(&mut data.value.agg);
493    }
494}
495
496impl<L> LinkCutTreePathFold for PathLinkCutTreeSpec<L>
497where
498    L: LazyMapMonoid,
499{
500    type Path = L::Agg;
501
502    fn fold_path(data: &Self::Data) -> Self::Path {
503        data.value.agg.clone()
504    }
505}
506
507impl<L> LinkCutTreePathUpdate for PathLinkCutTreeSpec<L>
508where
509    L: LazyMapMonoid,
510{
511    type PathAction = L::Act;
512
513    fn update_path(data: &mut Self::Data, action: &Self::PathAction) {
514        if !L::is_act_unit(action) {
515            Self::apply_non_unit(data, action);
516        }
517    }

Trait Implementations§

Source§

impl<L> LinkCutTreePathFold for PathLinkCutTreeSpec<L>
where L: LazyMapMonoid,

Source§

type Path = <L as LazyMapMonoid>::Agg

Source§

fn fold_path(data: &Self::Data) -> Self::Path

Source§

impl<L> LinkCutTreePathUpdate for PathLinkCutTreeSpec<L>
where L: LazyMapMonoid,

Source§

type PathAction = <L as LazyMapMonoid>::Act

Source§

fn update_path(data: &mut Self::Data, action: &Self::PathAction)

Source§

impl<L> LinkCutTreeSpec for PathLinkCutTreeSpec<L>
where L: LazyMapMonoid,

Source§

const ROOT_TO_NODE_TOP_DOWN: bool = false

Whether splay must propagate from the auxiliary root before rotations.
Source§

const MODIFY_REQUIRES_ACCESS: bool = false

Whether modify must expose the node to update virtual subtree state.
Source§

type Value = <L as LazyMapMonoid>::Key

Source§

type Data = PathLinkCutTreeData<L>

Source§

fn new(value: Self::Value) -> Self::Data

Source§

fn value(data: &Self::Data) -> &Self::Value

Source§

fn value_mut(data: &mut Self::Data) -> &mut Self::Value

Source§

fn top_down(data: &mut Self::Data, children: [Option<&mut Self::Data>; 2])

Source§

fn bottom_up(data: &mut Self::Data, children: [Option<&Self::Data>; 2])

Source§

fn reverse(data: &mut Self::Data)

Source§

fn attach_virtual(_parent: &mut Self::Data, _child: &mut Self::Data)

Source§

fn detach_virtual(_parent: &mut Self::Data, _child: &mut Self::Data)

Source§

fn transfer_path_parent(_old_root: &mut Self::Data, _new_root: &mut Self::Data)

Moves state associated with the same path-parent edge after a splay.

Auto Trait Implementations§

§

impl<L> Freeze for PathLinkCutTreeSpec<L>
where PhantomData<fn() -> L>: Freeze,

§

impl<L> RefUnwindSafe for PathLinkCutTreeSpec<L>
where PhantomData<fn() -> L>: RefUnwindSafe,

§

impl<L> Send for PathLinkCutTreeSpec<L>
where PhantomData<fn() -> L>: Send,

§

impl<L> Sync for PathLinkCutTreeSpec<L>
where PhantomData<fn() -> L>: Sync,

§

impl<L> Unpin for PathLinkCutTreeSpec<L>
where PhantomData<fn() -> L>: Unpin,

§

impl<L> UnsafeUnpin for PathLinkCutTreeSpec<L>
where PhantomData<fn() -> L>: UnsafeUnpin,

§

impl<L> UnwindSafe for PathLinkCutTreeSpec<L>
where PhantomData<fn() -> L>: 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> ToArrayVecScalar for T

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.