Type Alias re_entity_db::TimeHistogram

source ·
pub type TimeHistogram = Int64Histogram;
Expand description

Number of messages per time.

Aliased Type§

struct TimeHistogram { /* private fields */ }

Implementations

source§

impl Int64Histogram

source

pub fn increment(&mut self, key: i64, inc: u32)

Increment the count for the given key.

Incrementing with one is similar to inserting the key in a multi-set.

source

pub fn decrement(&mut self, key: i64, dec: u32) -> u32

Decrement the count for the given key.

The decrement is saturating.

Returns how much was actually decremented (found). If the returned value is less than the given value, it means that the key was either no found, or had a lower count.

source

pub fn remove(&mut self, range: impl RangeBounds<i64>) -> u64

Remove all data in the given range.

Returns how much count was removed.

Currently the implementation is optimized for the case of removing large continuous ranges. Removing many small, scattered ranges (e.g. individual elements) may cause performance problems! This can be remedied with some more code.

source

pub fn is_empty(&self) -> bool

Is the total count zero?

Note that incrementing a key with zero is a no-op and will leave an empty histogram still empty.

source

pub fn total_count(&self) -> u64

Total count of all the buckets.

NOTE: this is NOT the number of unique keys.

source

pub fn min_key(&self) -> Option<i64>

Lowest key with a non-zero count.

source

pub fn max_key(&self) -> Option<i64>

Highest key with a non-zero count.

source

pub fn range_count(&self, range: impl RangeBounds<i64>) -> u64

What is the count of all the buckets in the given range?

source

pub fn range(&self, range: impl RangeBounds<i64>, cutoff_size: u64) -> Iter<'_>

Iterate over a certain range, returning ranges that are at most cutoff_size long.

To get all individual entries, use cutoff_size<=1.

When cutoff_size > 1 you MAY get ranges which include keys that has no count. However, the ends (min/max) of all returned ranges will be keys with a non-zero count.

In other words, gaps in the key-space smaller than cutoff_size MAY be ignored by this iterator.

For example, inserting two elements at 10 and 15 and setting a cutoff_size=10 you may get a single range [10, 15] with the total count. You may also get two ranges of [10, 10] and [15, 15].

A larger cutoff_size will generally yield fewer ranges, and will be faster.

Trait Implementations

source§

impl Clone for Int64Histogram

source§

fn clone(&self) -> Int64Histogram

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Int64Histogram

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Int64Histogram

source§

fn default() -> Int64Histogram

Returns the “default value” for a type. Read more