pub struct PathLinkCutTreeSpec<L>(PhantomData<fn() -> L>);Tuple Fields§
§0: PhantomData<fn() -> L>Implementations§
Source§impl<L> PathLinkCutTreeSpec<L>where
L: LazyMapMonoid,
impl<L> PathLinkCutTreeSpec<L>where
L: LazyMapMonoid,
Sourcefn apply_non_unit(data: &mut PathLinkCutTreeData<L>, action: &L::Act)
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,
impl<L> LinkCutTreePathFold for PathLinkCutTreeSpec<L>where
L: LazyMapMonoid,
Source§impl<L> LinkCutTreePathUpdate for PathLinkCutTreeSpec<L>where
L: LazyMapMonoid,
impl<L> LinkCutTreePathUpdate for PathLinkCutTreeSpec<L>where
L: LazyMapMonoid,
type PathAction = <L as LazyMapMonoid>::Act
fn update_path(data: &mut Self::Data, action: &Self::PathAction)
Source§impl<L> LinkCutTreeSpec for PathLinkCutTreeSpec<L>where
L: LazyMapMonoid,
impl<L> LinkCutTreeSpec for PathLinkCutTreeSpec<L>where
L: LazyMapMonoid,
Source§const ROOT_TO_NODE_TOP_DOWN: bool = false
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
const MODIFY_REQUIRES_ACCESS: bool = false
Whether
modify must expose the node to update virtual subtree state.type Value = <L as LazyMapMonoid>::Key
type Data = PathLinkCutTreeData<L>
fn new(value: Self::Value) -> Self::Data
fn value(data: &Self::Data) -> &Self::Value
fn value_mut(data: &mut Self::Data) -> &mut Self::Value
fn top_down(data: &mut Self::Data, children: [Option<&mut Self::Data>; 2])
fn bottom_up(data: &mut Self::Data, children: [Option<&Self::Data>; 2])
fn reverse(data: &mut Self::Data)
fn attach_virtual(_parent: &mut Self::Data, _child: &mut Self::Data)
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)
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>
impl<L> RefUnwindSafe for PathLinkCutTreeSpec<L>
impl<L> Send for PathLinkCutTreeSpec<L>
impl<L> Sync for PathLinkCutTreeSpec<L>
impl<L> Unpin for PathLinkCutTreeSpec<L>
impl<L> UnsafeUnpin for PathLinkCutTreeSpec<L>
impl<L> UnwindSafe for PathLinkCutTreeSpec<L>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more