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>
impl<'a> WrappedCompactThetaSketch<'a>
Sourcepub fn wrap(bytes: &'a [u8]) -> Result<Self, SketchError>
pub fn wrap(bytes: &'a [u8]) -> Result<Self, SketchError>
Wraps a serialized compact theta sketch’s bytes without copying or fully deserializing them.
Sourcepub fn get_estimate(&self) -> f64
pub fn get_estimate(&self) -> f64
Returns the current estimate of the number of distinct items in the wrapped sketch.
Sourcepub fn get_lower_bound(&self, num_std_dev: u8) -> Result<f64, SketchError>
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.
Sourcepub fn get_upper_bound(&self, num_std_dev: u8) -> Result<f64, SketchError>
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.
Sourcepub fn is_estimation_mode(&self) -> bool
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).
Sourcepub fn is_ordered(&self) -> bool
pub fn is_ordered(&self) -> bool
Returns true if the wrapped sketch’s retained entries are sorted
by hash value.
Sourcepub fn get_theta(&self) -> f64
pub fn get_theta(&self) -> f64
Returns the wrapped sketch’s current theta threshold (1.0 if not
in estimation mode).
Sourcepub fn get_num_retained(&self) -> u32
pub fn get_num_retained(&self) -> u32
Returns the number of entries retained by the wrapped sketch.