Store

Trait Store 

Source
pub trait Store:
    Clone
    + Send
    + Sync {
    // Required methods
    fn add(&mut self, index: i32, count: u64);
    fn total_count(&self) -> u64;
    fn min_index(&self) -> Option<i32>;
    fn max_index(&self) -> Option<i32>;
    fn key_at_rank(&self, rank: u64) -> Option<i32>;
    fn merge(&mut self, other: &Self);
    fn is_empty(&self) -> bool;
    fn clear(&mut self);
    fn merge_from_proto(
        &mut self,
        proto: &ProtoStore,
    ) -> Result<(), ProtoConversionError>;
    fn to_proto(&self) -> ProtoStore;
}
Expand description

Storage for sketch observations.

Stores manage holding the counts of mapped values, such that they contain a list of bins and the number of observations currently counted in each bin.

Required Methods§

Source

fn add(&mut self, index: i32, count: u64)

Adds a count to the bin at the given index.

Source

fn total_count(&self) -> u64

Returns the total count across all bins.

Source

fn min_index(&self) -> Option<i32>

Returns the minimum index with a non-zero count, or None if empty.

Source

fn max_index(&self) -> Option<i32>

Returns the maximum index with a non-zero count, or None if empty.

Source

fn key_at_rank(&self, rank: u64) -> Option<i32>

Returns the index of the bin containing the given rank.

The rank is 0-indexed, so rank 0 is the first observation.

Source

fn merge(&mut self, other: &Self)

Merges another store into this one.

Source

fn is_empty(&self) -> bool

Returns true if the store is empty.

Source

fn clear(&mut self)

Clears all bins from the store.

Source

fn merge_from_proto( &mut self, proto: &ProtoStore, ) -> Result<(), ProtoConversionError>

Populates this store from a protobuf Store.

Source

fn to_proto(&self) -> ProtoStore

Converts this store to a protobuf Store.

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.

Implementors§