Skip to main content

WrappedCompactThetaSketch

Struct WrappedCompactThetaSketch 

Source
pub struct WrappedCompactThetaSketch<'a> { /* private fields */ }
Expand description

A zero-copy, read-only view over an already-serialized compact theta sketch’s bytes, usable directly as set-operation input without a full super::CompactThetaSketch::deserialize. Build one with Self::wrap.

The lifetime 'a ties this view to the borrowed &'a [u8] buffer it wraps — it cannot outlive the bytes it was built from.

Implementations§

Source§

impl<'a> WrappedCompactThetaSketch<'a>

Source

pub fn wrap(bytes: &'a [u8]) -> Result<Self, SketchError>

Wraps a serialized compact theta sketch’s bytes without copying or fully deserializing them.

Source

pub fn get_estimate(&self) -> f64

Returns the current estimate of the number of distinct items in the wrapped sketch.

Source

pub fn get_lower_bound(&self, num_std_dev: u8) -> Result<f64, SketchError>

Returns the lower bound of the confidence interval around Self::get_estimate. See ThetaSketch::get_lower_bound for the meaning of num_std_dev.

Source

pub fn get_upper_bound(&self, num_std_dev: u8) -> Result<f64, SketchError>

Returns the upper bound of the confidence interval around Self::get_estimate. See ThetaSketch::get_lower_bound for the meaning of num_std_dev.

Source

pub fn is_empty(&self) -> bool

Returns true if the wrapped sketch represents an empty set.

Source

pub fn is_estimation_mode(&self) -> bool

Returns true if the wrapped sketch’s theta threshold is below 1.0 (i.e. Self::get_estimate is a statistical estimate rather than an exact count).

Source

pub fn is_ordered(&self) -> bool

Returns true if the wrapped sketch’s retained entries are sorted by hash value.

Source

pub fn get_theta(&self) -> f64

Returns the wrapped sketch’s current theta threshold (1.0 if not in estimation mode).

Source

pub fn get_num_retained(&self) -> u32

Returns the number of entries retained by the wrapped sketch.

Trait Implementations§

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.