pub trait HistogramVal<T> {
// Required methods
fn get_bin_index<V: Borrow<T>>(&self, val: V) -> Result<usize, HistErrors>;
fn count_val<V: Borrow<T>>(&mut self, val: V) -> Result<usize, HistErrors>;
fn bin_enum_iter(&self) -> Box<dyn Iterator<Item = Bin<T>> + '_>;
fn is_inside<V: Borrow<T>>(&self, val: V) -> bool;
fn not_inside<V: Borrow<T>>(&self, val: V) -> bool;
fn first_border(&self) -> T;
fn last_border(&self) -> T;
fn last_border_is_inclusive(&self) -> bool;
fn distance<V: Borrow<T>>(&self, val: V) -> f64;
}
Expand description
- trait used for mapping values of arbitrary type
T
to bins - used to create a histogram
Required Methods§
Sourcefn get_bin_index<V: Borrow<T>>(&self, val: V) -> Result<usize, HistErrors>
fn get_bin_index<V: Borrow<T>>(&self, val: V) -> Result<usize, HistErrors>
convert val to the respective histogram index
Sourcefn count_val<V: Borrow<T>>(&mut self, val: V) -> Result<usize, HistErrors>
fn count_val<V: Borrow<T>>(&mut self, val: V) -> Result<usize, HistErrors>
count val. Ok(index)
, if inside of hist, Err(_)
if val is invalid
Sourcefn bin_enum_iter(&self) -> Box<dyn Iterator<Item = Bin<T>> + '_>
fn bin_enum_iter(&self) -> Box<dyn Iterator<Item = Bin<T>> + '_>
§binning borders
- the borders used to bin the values
Sourcefn not_inside<V: Borrow<T>>(&self, val: V) -> bool
fn not_inside<V: Borrow<T>>(&self, val: V) -> bool
opposite of is_inside
Sourcefn first_border(&self) -> T
fn first_border(&self) -> T
get the left most border (inclusive)
Sourcefn last_border(&self) -> T
fn last_border(&self) -> T
§get last border from the right
- Note: this border might be inclusive or exclusive
- check
last_border_is_inclusive
for finding it out
Sourcefn last_border_is_inclusive(&self) -> bool
fn last_border_is_inclusive(&self) -> bool
§True if last border is inclusive, false otherwise
- For most usecases this will return a constant value, as this is likely only dependent on the underlying type and not on something that changes dynamically
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.