MonoidActElement

Struct MonoidActElement 

Source
pub struct MonoidActElement<M>
where M: MonoidAct,
{ pub key: M::Key, pub act: M::Act, }

Fields§

§key: M::Key§act: M::Act

Implementations§

Source§

impl<M> MonoidActElement<M>
where M: MonoidAct,

Source

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

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 375)
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: &M::Act)
where Spec: BstSpec<Data: BstDataAccess<MonoidAct, Value = Self>>,

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 483)
481    pub fn update_key(&mut self, act: M::Act) {
482        if let Some(node) = self.split3.mid_datamut() {
483            MonoidActElement::<M>::update_act(node, &act);
484            self.key_updated = true;
485        }
486    }
More examples
Hide additional examples
crates/competitive/src/data_structure/binary_search_tree/data.rs (line 100)
94    pub fn top_down<Spec>(mut node: BstDataMutRef<'_, Spec>)
95    where
96        Spec: BstSpec<Data: BstDataAccess<marker::MonoidAct, Value = Self>>,
97    {
98        let act = replace(&mut node.data_mut().bst_data_mut().act, M::unit());
99        if let Ok(left) = node.reborrow_datamut().left().descend() {
100            Self::update_act(left, &act);
101        }
102        if let Ok(right) = node.reborrow_datamut().right().descend() {
103            Self::update_act(right, &act);
104        }
105    }
Source

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

Examples found in repository?
crates/competitive/src/data_structure/treap.rs (line 109)
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    }

Trait Implementations§

Source§

impl<M> Debug for MonoidActElement<M>
where M: MonoidAct<Key: Debug, Act: Debug>,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> Freeze for MonoidActElement<M>
where <M as MonoidAct>::Key: Freeze, <M as MonoidAct>::Act: Freeze,

§

impl<M> RefUnwindSafe for MonoidActElement<M>

§

impl<M> Send for MonoidActElement<M>
where <M as MonoidAct>::Key: Send, <M as MonoidAct>::Act: Send,

§

impl<M> Sync for MonoidActElement<M>
where <M as MonoidAct>::Key: Sync, <M as MonoidAct>::Act: Sync,

§

impl<M> Unpin for MonoidActElement<M>
where <M as MonoidAct>::Key: Unpin, <M as MonoidAct>::Act: Unpin,

§

impl<M> UnwindSafe for MonoidActElement<M>
where <M as MonoidAct>::Key: UnwindSafe, <M as MonoidAct>::Act: 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, 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.