LazyMapElement

Struct LazyMapElement 

Source
pub struct LazyMapElement<L>
where L: LazyMapMonoid,
{ pub key: L::Key, pub agg: L::Agg, pub act: L::Act, }

Fields§

§key: L::Key§agg: L::Agg§act: L::Act

Implementations§

Source§

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

Source

pub fn from_key(key: L::Key) -> Self

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 376)
371    pub fn insert(&mut self, key: M::Key, value: L::Key) -> BstNodeId<TreapSpec<M, L>> {
372        let (left, right) = TreapSpec::split(self.root.take(), SeekByKey::new(&key), false);
373        let data = TreapData {
374            priority: self.rng.rand64(),
375            key: MonoidActElement::from_key(key),
376            value: LazyMapElement::from_key(value),
377        };
378        let node = BstRoot::from_data(data, self.allocator.deref_mut());
379        let node_id = self.node_id_manager.register(&node);
380        self.root = TreapSpec::merge(TreapSpec::merge(left, Some(node)), right);
381        node_id
382    }
Source

pub fn update_act<Spec>(node: BstDataMutRef<'_, Spec>, act: &L::Act)
where Spec: BstSpec<Data: BstDataAccess<LazyMap, Value = Self>>,

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 490)
488    pub fn update_value(&mut self, act: L::Act) {
489        if let Some(node) = self.split3.mid_datamut() {
490            LazyMapElement::<L>::update_act(node, &act);
491        }
492    }
More examples
Hide additional examples
crates/competitive/src/data_structure/binary_search_tree/data.rs (line 164)
158    pub fn top_down<Spec>(mut node: BstDataMutRef<'_, Spec>)
159    where
160        Spec: BstSpec<Data: BstDataAccess<marker::LazyMap, Value = Self>>,
161    {
162        let act = replace(&mut node.data_mut().bst_data_mut().act, L::act_unit());
163        if let Ok(left) = node.reborrow_datamut().left().descend() {
164            Self::update_act(left, &act);
165        }
166        if let Ok(right) = node.reborrow_datamut().right().descend() {
167            Self::update_act(right, &act);
168        }
169    }
Source

pub fn top_down<Spec>(node: BstDataMutRef<'_, Spec>)
where Spec: BstSpec<Data: BstDataAccess<LazyMap, Value = Self>>,

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 110)
108    fn top_down(mut node: BstDataMutRef<'_, Self>) {
109        MonoidActElement::<M>::top_down(node.reborrow_datamut());
110        LazyMapElement::<L>::top_down(node.reborrow_datamut());
111    }
More examples
Hide additional examples
crates/competitive/src/data_structure/binary_search_tree/data.rs (line 153)
143    pub fn update_act<Spec>(mut node: BstDataMutRef<'_, Spec>, act: &L::Act)
144    where
145        Spec: BstSpec<Data: BstDataAccess<marker::LazyMap, Value = Self>>,
146    {
147        L::act_operate_assign(&mut node.data_mut().bst_data_mut().act, act);
148        node.data_mut().bst_data_mut().key =
149            L::act_key(&node.reborrow().into_data().bst_data().key, act);
150        if let Some(nxlazy) = L::act_agg(&node.reborrow().into_data().bst_data().agg, act) {
151            node.data_mut().bst_data_mut().agg = nxlazy;
152        } else {
153            Self::top_down(node.reborrow_datamut());
154            Self::bottom_up(node.reborrow_datamut());
155        }
156    }
Source

pub fn bottom_up<Spec>(node: BstDataMutRef<'_, Spec>)
where Spec: BstSpec<Data: BstDataAccess<LazyMap, Value = Self>>,

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 114)
113    fn bottom_up(mut node: BstDataMutRef<'_, Self>) {
114        LazyMapElement::<L>::bottom_up(node.reborrow_datamut());
115    }
More examples
Hide additional examples
crates/competitive/src/data_structure/binary_search_tree/data.rs (line 154)
143    pub fn update_act<Spec>(mut node: BstDataMutRef<'_, Spec>, act: &L::Act)
144    where
145        Spec: BstSpec<Data: BstDataAccess<marker::LazyMap, Value = Self>>,
146    {
147        L::act_operate_assign(&mut node.data_mut().bst_data_mut().act, act);
148        node.data_mut().bst_data_mut().key =
149            L::act_key(&node.reborrow().into_data().bst_data().key, act);
150        if let Some(nxlazy) = L::act_agg(&node.reborrow().into_data().bst_data().agg, act) {
151            node.data_mut().bst_data_mut().agg = nxlazy;
152        } else {
153            Self::top_down(node.reborrow_datamut());
154            Self::bottom_up(node.reborrow_datamut());
155        }
156    }

Trait Implementations§

Source§

impl<L> Debug for LazyMapElement<L>
where L: LazyMapMonoid<Key: Debug, Agg: Debug, Act: Debug>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.