Module grove::data [−][src]
Expand description
This module representes the values that can be put inside a segment tree, the summaries that you can receive from a query about a segment in the segment tree, and the actions that you can perform on the segment tree.
In order for a choice of types for Value
, Summary
and Action
, to work
in a segment tree, they must be an instance of the Data
trait.
In addition, this module provides the SizedSummary
and Keyed
traits,
and some common possible instantiations in the example_data
module.
Re-exports
pub use example_data::Keyed;
pub use example_data::SizedSummary;
Modules
A module for examples of possible instantiations for Data::Value
, Data::Summary
,
Data::Action
and Data
itself.
Traits
Trait representing actions. this entailes having an identity action (Default
), being able to compose actions
(Add
<Output=Self>
), checking whether an action is the identity action, and checking whether this action
reverses subsegments.
In order for the segment trees to work correctly, all of the operations must play nicely with each other.
In particular, it must obey these rules:
Trait representation actions on a type V
. If A: Acts<V>
that means that given any action: A
,
we can apply it to any val: V
. This trait is used to represent the actions on
values and summaries used by segment trees.
This trait represents the data that will be stored inside the tree.
This trait is implemented by Values, and provides a conversion from a value to the summary of that single value.