pub trait LazySegTreeSpec {
type T: Clone;
type U: Clone;
const ID: Self::T;
// Required methods
fn op_on_data(d1: &Self::T, d2: &Self::T) -> Self::T;
fn op_on_update(u1: &Self::U, u2: &Self::U) -> Self::U;
fn op_update_on_data(u: &Self::U, d: &Self::T, size: usize) -> Self::T;
// Provided method
fn op_on_update_option(
existing_tag: &Option<Self::U>,
new_tag: &Self::U,
) -> Option<Self::U> { ... }
}
Expand description
Specification trait for LazySegTree
.
Implement this trait to define the concrete behavior of the tree:
T
: data stored in nodes (the aggregate type),U
: lazy-update type (the tag type),ID
: identity element forT
.
Required operations:
op_on_data
— combine twoT
s into one (e.g., sum or min),op_on_update
— compose two updatesU
into a single update,op_update_on_data
— apply an updateU
toT
representingsize
leaves.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn op_on_data(d1: &Self::T, d2: &Self::T) -> Self::T
fn op_on_data(d1: &Self::T, d2: &Self::T) -> Self::T
Combine two child values into a parent value.
Sourcefn op_on_update(u1: &Self::U, u2: &Self::U) -> Self::U
fn op_on_update(u1: &Self::U, u2: &Self::U) -> Self::U
Compose two updates. If update a
is applied before b
, then the
composed update should be op_on_update(a, b)
(document the intended
order in non-commutative cases).
Provided Methods§
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.