Struct CompressedHistogram

Source
pub struct CompressedHistogram { /* private fields */ }
Expand description

Though not fixed, CompressedHistogram encodes histograms using less space than a StandardHistogram. All of the frequencies for each label are approximated by a next greatest exponent. CompressedHistogram uses a library HashMap to store the label-frequency pairs, so it is unbounded in terms of space. It is associated with CompressedParams

There are 2 parameters:

  • b -> This floating point number is the base of the approximating exponent.
  • max_exp -> This is the number of distinct values that can potentially be stored.

A CompressedHistogram must be derived from a StandardHistogram using the to_compressed function.

Trait Implementations§

Source§

impl Histogram<CompressedParams, usize, usize> for CompressedHistogram

Source§

fn total(&self) -> usize

returns whichever is greater, the compressed or decompressed size

Source§

fn labels( &self, _params: &CompressedParams, ) -> Option<Box<dyn Iterator<Item = usize>>>

If possible, creates and returns an iterator for the labels for which the histogram has frequencies stored.
Source§

fn frequency(&self, label: usize, params: &CompressedParams) -> Option<usize>

If possible, returns the frequency of a particular label. The behavior need only be defined if the label is in the set of values returned from labels.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.