pub struct BucketSet { /* private fields */ }Expand description
A collection for buckets in an exponential histogram.
The set stores sparse, sorted buckets as a tuple of their midpoint (Point), and count of occurrences.
Implementations§
Source§impl BucketSet
impl BucketSet
Sourcepub fn try_from_str(s: &str) -> Result<Self, ParseBucketSetError>
pub fn try_from_str(s: &str) -> Result<Self, ParseBucketSetError>
Parse a BucketSet from its raw textual representation.
Sourcepub fn observe_all(&mut self, value: Point, count: u64)
pub fn observe_all(&mut self, value: Point, count: u64)
Sourcepub fn remap(&mut self, map: impl FnMut(Point) -> Point)
pub fn remap(&mut self, map: impl FnMut(Point) -> Point)
Remap and merge buckets.
This method can be used to rescale the buckets to a coarser granularity in combination with the crate::metric::exp::midpoint function. It accepts a closure that maps stored bucket Points to new values. When multiple buckets map to the same new value, their counts will be summed.
§Panics
This method will panic if adding count to an existing entry in value would overflow. This can happen when merging buckets with large counts.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the number of buckets currently in the set.
This is not the total count of observed values in all buckets, just the count of buckets themselves. See BucketSet::total for the total count.
Trait Implementations§
impl Eq for BucketSet
Source§impl<'a> Extend<(Point, u64)> for BucketSet
impl<'a> Extend<(Point, u64)> for BucketSet
Source§fn extend<I: IntoIterator<Item = (Point, u64)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (Point, u64)>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<'a> FromValue<'a> for BucketSet
impl<'a> FromValue<'a> for BucketSet
Source§fn from_value(v: Value<'a>) -> Option<Self>
fn from_value(v: Value<'a>) -> Option<Self>
Source§impl<'a> IntoIterator for &'a BucketSet
impl<'a> IntoIterator for &'a BucketSet
impl StructuralPartialEq for BucketSet
Source§impl Value for BucketSet
Available on crate feature sval only.
impl Value for BucketSet
sval only.Source§fn stream<'sval, S: Stream<'sval> + ?Sized>(
&'sval self,
stream: &mut S,
) -> Result
fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S, ) -> Result
Stream.