pub struct FlipHistogram<'a> { /* private fields */ }Expand description
Bucket based histogram used internally by FlipPool.
Generally you should not need to use this directly and any mutating operations are unsafe to prevent violating FlipPool invariants.
Implementations§
Source§impl<'a> FlipHistogram<'a>
impl<'a> FlipHistogram<'a>
Sourcepub fn bucket_size(&self) -> usize
pub fn bucket_size(&self) -> usize
Returns the difference between the maximum and minimum bucket values.
Sourcepub fn bucket_id_min(&self) -> Option<usize>
pub fn bucket_id_min(&self) -> Option<usize>
Returns the index of the lowest bucket currently in use.
If no buckets are in use, returns None.
Sourcepub fn bucket_id_max(&self) -> usize
pub fn bucket_id_max(&self) -> usize
Returns the index of the highest bucket currently in use.
If no buckets are in use, returns 0.
Sourcepub fn bucket_value_count(&self, bucket_id: usize) -> usize
pub fn bucket_value_count(&self, bucket_id: usize) -> usize
Returns the amount of values contained within a given bucket.
§Panics
- If the bucket_id is out of bounds.
Sourcepub fn bucket_count(&self) -> usize
pub fn bucket_count(&self) -> usize
Returns the amount of buckets in the histogram.
Sourcepub fn minimum_allowed_value(&self) -> f32
pub fn minimum_allowed_value(&self) -> f32
Returns the smallest value the histogram can handle.
Sourcepub fn maximum_allowed_value(&self) -> f32
pub fn maximum_allowed_value(&self) -> f32
Returns the largest value the histogram can handle.
Sourcepub unsafe fn clear(&mut self)
pub unsafe fn clear(&mut self)
Clears the histogram of all values
§Safety
Due to the many invariants between the histogram and the pool, we do not provide any safty guarentees when mutating the histogram.
Sourcepub unsafe fn resize(&mut self, bucket_size: usize)
pub unsafe fn resize(&mut self, bucket_size: usize)
Resizes the histogram to have bucket_size buckets.
§Safety
Due to the many invariants between the histogram and the pool, we do not provide any safty guarentees when mutating the histogram.
Sourcepub fn bucket_id(&self, value: f32) -> usize
pub fn bucket_id(&self, value: f32) -> usize
Returns which bucket a given value would fall into.
Sourcepub unsafe fn include_value(&mut self, value: f32, count: usize)
pub unsafe fn include_value(&mut self, value: f32, count: usize)
Includes count instances of the following value in the histogram.
§Safety
Due to the many invariants between the histogram and the pool, we do not provide any safty guarentees when mutating the histogram.
Sourcepub unsafe fn include_image(&mut self, image: &FlipImageFloat)
pub unsafe fn include_image(&mut self, image: &FlipImageFloat)
Includes one instance of each value in the given image in the histogram.
§Safety
Due to the many invariants between the histogram and the pool, we do not provide any safty guarentees when mutating the histogram.