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?
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 }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 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 }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 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 }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 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§
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> 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