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

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

Replace the value in a with combine(a, b). This function exists to allow certain optimizations and by default simply calls combine.

Replace the value in a with combine(a, b). This function exists to allow certain optimizations and by default simply calls combine.

Must return the same as combine. This function exists to allow certain optimizations and by default simply calls combine_mut.

Must return the same as combine. This function exists to allow certain optimizations and by default simply calls combine_mut2.

Must return the same as combine. This function exists to allow certain optimizations and by default simply calls combine_left.

Implementors