Trait segment_tree::ops::Operation
[−]
[src]
pub trait Operation<N> {
fn combine(a: &N, b: &N) -> N;
fn combine_mut(a: &mut N, b: &N) { ... }
fn combine_mut2(a: &N, b: &mut N) { ... }
fn combine_left(a: N, b: &N) -> N { ... }
fn combine_right(a: &N, b: N) -> N { ... }
fn combine_both(a: N, b: N) -> N { ... }
}A trait that specifies which associative operator to use in a segment tree.
Required Methods
fn combine(a: &N, b: &N) -> N
The operation that is performed to combine two intervals in the segment tree.
This function must be associative, that is combine(combine(a, b), c) = combine(a, combine(b, c)).
Provided Methods
fn combine_mut(a: &mut N, b: &N)
Replace the value in a with combine(a, b). This function exists to allow certain
optimizations and by default simply calls combine.
fn combine_mut2(a: &N, b: &mut N)
Replace the value in a with combine(a, b). This function exists to allow certain
optimizations and by default simply calls combine.
fn combine_left(a: N, b: &N) -> N
Must return the same as combine. This function exists to allow certain optimizations
and by default simply calls combine_mut.
fn combine_right(a: &N, b: N) -> N
Must return the same as combine. This function exists to allow certain optimizations
and by default simply calls combine_mut2.
fn combine_both(a: N, b: N) -> N
Must return the same as combine. This function exists to allow certain optimizations
and by default simply calls combine_left.
Implementors
impl<T: Add<Output = T> + Copy> Operation<T> for Addimpl<T: Mul<Output = T> + Copy> Operation<T> for Mulimpl<T: BitXor<Output = T> + Copy> Operation<T> for Xorimpl<T: BitAnd<Output = T> + Copy> Operation<T> for Andimpl<T: BitOr<Output = T> + Copy> Operation<T> for Orimpl<T: Ord + Copy> Operation<T> for Maximpl Operation<f32> for MaxIgnoreNaNimpl Operation<f64> for MaxIgnoreNaNimpl Operation<f32> for MaxTakeNaNimpl Operation<f64> for MaxTakeNaNimpl<T: Ord + Copy> Operation<T> for Minimpl Operation<f32> for MinIgnoreNaNimpl Operation<f64> for MinIgnoreNaNimpl Operation<f32> for MinTakeNaNimpl Operation<f64> for MinTakeNaNimpl<TA, TB, A: Operation<TA>, B: Operation<TB>> Operation<(TA, TB)> for Pair<A, B>impl<TA: Clone, A: Operation<TA>> Operation<Option<TA>> for WithIdentity<A>