FlipHistogram

Struct FlipHistogram 

Source
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>

Source

pub fn bucket_size(&self) -> usize

Returns the difference between the maximum and minimum bucket values.

Source

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.

Source

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.

Source

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.
Source

pub fn bucket_count(&self) -> usize

Returns the amount of buckets in the histogram.

Source

pub fn minimum_allowed_value(&self) -> f32

Returns the smallest value the histogram can handle.

Source

pub fn maximum_allowed_value(&self) -> f32

Returns the largest value the histogram can handle.

Source

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.

Source

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.

Source

pub fn bucket_id(&self, value: f32) -> usize

Returns which bucket a given value would fall into.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for FlipHistogram<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for FlipHistogram<'_>

Source§

impl Sync for FlipHistogram<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for FlipHistogram<'a>

§

impl<'a> RefUnwindSafe for FlipHistogram<'a>

§

impl<'a> Unpin for FlipHistogram<'a>

§

impl<'a> UnwindSafe for FlipHistogram<'a>

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.