Struct relay_metrics::BucketsView
source · pub struct BucketsView<'a> { /* private fields */ }
Expand description
A view into a slice of metric buckets.
The view can be used to iterate over a large slice of metric data slicing even into the buckets themselves.
Full View
/---------------------------------------------\
[[C:1], [C:12], [D:0, 1, 2, 3, 5, 5], [S:42, 75]]
\--------------------------/ \---------------/
View 1 View 2
Iterating over a BucketsView
yields BucketView
items,
only the first and last elements may be partial buckets.
In the above example View 1
has a partial bucket at the end and
View 2
has a partial bucket in the beginning.
Using the above example, iterating over View 1
yields the buckets:
[C:1], [C:12], [D:0, 1, 2, 3]
.
Implementations§
source§impl<'a> BucketsView<'a>
impl<'a> BucketsView<'a>
sourcepub fn new(buckets: &'a [Bucket]) -> Self
pub fn new(buckets: &'a [Bucket]) -> Self
Creates a new buckets view containing all data from the slice.
sourcepub fn iter(&self) -> BucketsViewIter<'a> ⓘ
pub fn iter(&self) -> BucketsViewIter<'a> ⓘ
Iterator over all buckets in the view.
sourcepub fn by_size(&self, size_in_bytes: usize) -> BucketsViewBySizeIter<'a> ⓘ
pub fn by_size(&self, size_in_bytes: usize) -> BucketsViewBySizeIter<'a> ⓘ
Iterator which slices the source view into segments with an approximate size of size_in_bytes
.
Trait Implementations§
source§impl<'a> Debug for BucketsView<'a>
impl<'a> Debug for BucketsView<'a>
source§impl<'a> IntoIterator for &BucketsView<'a>
impl<'a> IntoIterator for &BucketsView<'a>
source§impl<'a> IntoIterator for BucketsView<'a>
impl<'a> IntoIterator for BucketsView<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for BucketsView<'a>
impl<'a> Send for BucketsView<'a>
impl<'a> Sync for BucketsView<'a>
impl<'a> Unpin for BucketsView<'a>
impl<'a> UnwindSafe for BucketsView<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more