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::ActImplementations§
Source§impl<L> LazyMapElement<L>where
L: LazyMapMonoid,
impl<L> LazyMapElement<L>where
L: LazyMapMonoid,
Sourcepub fn from_key(key: L::Key) -> Self
pub fn from_key(key: L::Key) -> Self
Examples found in repository?
More examples
crates/competitive/src/data_structure/treap.rs (line 372)
366 pub fn insert(&mut self, key: M::Key, value: L::Key) -> BstNodeId<TreapSpec<M, L>> {
367 let (left, right) =
368 TreapSpec::split(self.root.take(), SeekByKey::new(&key), EqualSide::Right);
369 let data = TreapData {
370 priority: self.rng.rand64(),
371 key: MonoidActElement::from_key(key),
372 value: LazyMapElement::from_key(value),
373 };
374 let node = BstRoot::from_data(data, self.allocator.deref_mut());
375 let node_id = self.node_id_manager.register(&node);
376 self.root = TreapSpec::merge(TreapSpec::merge(left, Some(node)), right);
377 node_id
378 }Sourcepub fn update_act<Spec>(node: BstDataMutRef<'_, Spec>, act: &L::Act)
pub fn update_act<Spec>(node: BstDataMutRef<'_, Spec>, act: &L::Act)
Examples found in repository?
More examples
crates/competitive/src/data_structure/binary_search_tree/data.rs (line 170)
161 pub fn top_down<Spec>(mut node: BstDataMutRef<'_, Spec>)
162 where
163 Spec: BstSpec<Data: BstDataAccess<marker::LazyMap, Value = Self>>,
164 {
165 if L::is_act_unit(&node.reborrow().into_data().bst_data().act) {
166 return;
167 }
168 let act = replace(&mut node.data_mut().bst_data_mut().act, L::act_unit());
169 if let Ok(left) = node.reborrow_datamut().left().descend() {
170 Self::update_act(left, &act);
171 }
172 if let Ok(right) = node.reborrow_datamut().right().descend() {
173 Self::update_act(right, &act);
174 }
175 }Sourcepub fn top_down<Spec>(node: BstDataMutRef<'_, Spec>)
pub fn top_down<Spec>(node: BstDataMutRef<'_, Spec>)
Examples found in repository?
More examples
crates/competitive/src/data_structure/binary_search_tree/data.rs (line 156)
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 if L::is_act_unit(act) {
148 return;
149 }
150 L::act_operate_assign(&mut node.data_mut().bst_data_mut().act, act);
151 node.data_mut().bst_data_mut().key =
152 L::act_key(&node.reborrow().into_data().bst_data().key, act);
153 if let Some(nxlazy) = L::act_agg(&node.reborrow().into_data().bst_data().agg, act) {
154 node.data_mut().bst_data_mut().agg = nxlazy;
155 } else {
156 Self::top_down(node.reborrow_datamut());
157 Self::bottom_up(node.reborrow_datamut());
158 }
159 }Sourcepub fn bottom_up<Spec>(node: BstDataMutRef<'_, Spec>)
pub fn bottom_up<Spec>(node: BstDataMutRef<'_, Spec>)
Examples found in repository?
More examples
crates/competitive/src/data_structure/binary_search_tree/data.rs (line 157)
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 if L::is_act_unit(act) {
148 return;
149 }
150 L::act_operate_assign(&mut node.data_mut().bst_data_mut().act, act);
151 node.data_mut().bst_data_mut().key =
152 L::act_key(&node.reborrow().into_data().bst_data().key, act);
153 if let Some(nxlazy) = L::act_agg(&node.reborrow().into_data().bst_data().agg, act) {
154 node.data_mut().bst_data_mut().agg = nxlazy;
155 } else {
156 Self::top_down(node.reborrow_datamut());
157 Self::bottom_up(node.reborrow_datamut());
158 }
159 }Trait Implementations§
Auto Trait Implementations§
impl<L> Freeze for LazyMapElement<L>where
<L as LazyMapMonoid>::Key: Freeze,
<L as LazyMapMonoid>::Agg: Freeze,
<L as LazyMapMonoid>::Act: Freeze,
impl<L> RefUnwindSafe for LazyMapElement<L>where
<L as LazyMapMonoid>::Key: RefUnwindSafe,
<L as LazyMapMonoid>::Agg: RefUnwindSafe,
<L as LazyMapMonoid>::Act: RefUnwindSafe,
impl<L> Send for LazyMapElement<L>where
<L as LazyMapMonoid>::Key: Send,
<L as LazyMapMonoid>::Agg: Send,
<L as LazyMapMonoid>::Act: Send,
impl<L> Sync for LazyMapElement<L>where
<L as LazyMapMonoid>::Key: Sync,
<L as LazyMapMonoid>::Agg: Sync,
<L as LazyMapMonoid>::Act: Sync,
impl<L> Unpin for LazyMapElement<L>where
<L as LazyMapMonoid>::Key: Unpin,
<L as LazyMapMonoid>::Agg: Unpin,
<L as LazyMapMonoid>::Act: Unpin,
impl<L> UnsafeUnpin for LazyMapElement<L>where
<L as LazyMapMonoid>::Key: UnsafeUnpin,
<L as LazyMapMonoid>::Agg: UnsafeUnpin,
<L as LazyMapMonoid>::Act: UnsafeUnpin,
impl<L> UnwindSafe for LazyMapElement<L>where
<L as LazyMapMonoid>::Key: UnwindSafe,
<L as LazyMapMonoid>::Agg: UnwindSafe,
<L as LazyMapMonoid>::Act: UnwindSafe,
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