pub struct DDSketch { /* private fields */ }
Expand description

This struct represents a DDSketch

Implementations§

source§

impl DDSketch

source

pub fn new(config: Config) -> Self

Construct a DDSketch. Requires a Config specifying the parameters of the sketch

source

pub fn add(&mut self, v: f64)

Add the sample to the sketch

source

pub fn quantile(&self, q: f64) -> Result<Option<f64>, DDSketchError>

Return the quantile value for quantiles between 0.0 and 1.0. Result is an error, represented as DDSketchError::Quantile if the requested quantile is outside of that range.

If the sketch is empty the result is None, else Some(v) for the quantile value.

source

pub fn min(&self) -> Option<f64>

Returns the minimum value seen, or None if sketch is empty

source

pub fn max(&self) -> Option<f64>

Returns the maximum value seen, or None if sketch is empty

source

pub fn sum(&self) -> Option<f64>

Returns the sum of values seen, or None if sketch is empty

source

pub fn count(&self) -> usize

Returns the number of values added to the sketch

source

pub fn length(&self) -> usize

Returns the length of the underlying Store. This is mainly only useful for understanding how much the sketch has grown given the inserted values.

source

pub fn merge(&mut self, o: &DDSketch) -> Result<(), DDSketchError>

Merge the contents of another sketch into this one. The sketch that is merged into this one is unchanged after the merge.

Trait Implementations§

source§

impl Clone for DDSketch

source§

fn clone(&self) -> DDSketch

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 Default for DDSketch

source§

fn default() -> Self

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

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.