Trait Action

Source
pub trait Action {
    type Output: Monoid;
    type Lazy: Monoid;

    // Required method
    fn convert(
        value: Self::Output,
        lazy: Self::Lazy,
        len: usize,
    ) -> Self::Output;

    // Provided methods
    fn fold_id() -> Self::Output { ... }
    fn fold(a: Self::Output, b: Self::Output) -> Self::Output { ... }
    fn update_id() -> Self::Lazy { ... }
    fn update(cur: Self::Lazy, next: Self::Lazy) -> Self::Lazy { ... }
}
Expand description

遅延セグメント木などに載せる構造

Required Associated Types§

Source

type Output: Monoid

範囲取得の型

Source

type Lazy: Monoid

範囲更新の型

Required Methods§

Source

fn convert(value: Self::Output, lazy: Self::Lazy, len: usize) -> Self::Output

範囲更新を範囲取得に反映させる。

Provided Methods§

Source

fn fold_id() -> Self::Output

範囲取得のモノイドの単位元を返す。

Source

fn fold(a: Self::Output, b: Self::Output) -> Self::Output

範囲取得のモノイドの二項演算を適用させる。

Source

fn update_id() -> Self::Lazy

範囲更新のモノイドの単位元を返す。

Source

fn update(cur: Self::Lazy, next: Self::Lazy) -> Self::Lazy

範囲更新のモノイドの二項演算を適用させる。

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<M> Action for UpdateFold<M>
where M: Monoid + Clone,

Source§

type Output = M

Source§

type Lazy = Last<M>

Source§

impl<T> Action for UpdateSum<T>
where Sum<T>: Monoid, Last<T>: Monoid, T: Mul<Output = T> + TryFrom<usize, Error: Debug>,

Source§

type Output = Sum<T>

Source§

type Lazy = Last<T>

Source§

impl<T, U> Action for AddMinCount<T, U>
where MinCount<T, U>: Monoid, Sum<T>: Monoid, T: Add<Output = T>,

Source§

type Output = MinCount<T, U>

Source§

type Lazy = Sum<T>

Source§

impl<T, U> Action for AddSum<T, U>
where Sum<T>: Monoid, Sum<U>: Monoid, T: Add<Output = T> + TryFrom<U, Error: Debug>, U: Mul<Output = U> + TryFrom<usize, Error: Debug>,

Source§

type Output = Sum<T>

Source§

type Lazy = Sum<U>

Source§

impl<T, U> Action for AffineSum<T, U>
where Sum<T>: Monoid, Affine<U>: Monoid, T: Add<Output = T> + Mul<Output = T> + TryFrom<U, Error: Debug>, U: Mul<Output = U> + TryFrom<usize, Error: Debug>,