Module segment_tree::ops [] [src]

Module of operations that can be performed in a segment tree.

A segment tree needs some operation, and this module contains the main Operation trait, together with the marker trait CommutativeOperation. This module also contains implementations for simple operations.

Structs

Add

Each node contains the sum of the interval it represents.

And

Each node contains the bitwise and of the interval it represents.

Max

Each node contains the maximum value in the interval it represents.

MaxIgnoreNaN

Variant of Max that considers NaN smaller than anything.

MaxTakeNaN

Variant of Max that considers NaN larger than anything.

Min

Each node contains the minimum value in the interval it represents.

MinIgnoreNaN

Variant of Min that considers NaN larger than anything.

MinTakeNaN

Variant of Min that considers NaN smaller than anything.

Mul

Each node contains the product of the interval it represents.

Or

Each node contains the bitwise or of the interval it represents.

Pair

Store more information in each node.

WithIdentity

Adds an identity to an operation by wrapping the type in Option. Clones when combined with None.

Xor

Each node contains the bitwise xor of the interval it represents.

Traits

CommutativeOperation

A marker trait that specifies that an Operation is commutative, that is: combine(a, b) = combine(b, a).

Identity

A trait that specifies that this type has an identity under this operation.

Inverse

A trait that specifies that this type allows uncombining.

Operation

A trait that specifies which associative operator to use in a segment tree.