Struct ndhistogram::axis::CategoryNoFlow
source · pub struct CategoryNoFlow<T>where
T: Eq + Hash,{ /* private fields */ }
Expand description
An axis to represent a finite set of discrete values or categories without an overflow bin.
Similar to Category, however, no overflow bin is included.
Example
use ndhistogram::axis::{Axis, CategoryNoFlow, SingleValueBinInterval};
let colors = CategoryNoFlow::new(vec!["red", "blue", "pink", "yellow", "black"]);
assert_eq!(colors.index(&"red"), Some(0));
assert_eq!(colors.index(&"green"), None);
assert_eq!(colors.bin(1), Some(SingleValueBinInterval::new("blue")));
assert_eq!(colors.bin(5), None);
Implementations§
source§impl<T: Value> CategoryNoFlow<T>
impl<T: Value> CategoryNoFlow<T>
sourcepub fn new<I: IntoIterator<Item = T>>(values: I) -> Self
pub fn new<I: IntoIterator<Item = T>>(values: I) -> Self
Factory method to create a category axis without an overflow bin.
Takes a set of values that represent each category. All other values will not be included in this axis.
Trait Implementations§
source§impl<T: Value> Axis for CategoryNoFlow<T>
impl<T: Value> Axis for CategoryNoFlow<T>
§type Coordinate = T
type Coordinate = T
The type representing a location on this axis.
§type BinInterval = SingleValueBinInterval<T>
type BinInterval = SingleValueBinInterval<T>
The type of an interval representing the set of Coordinates that correspond to a histogram bin
source§fn index(&self, coordinate: &Self::Coordinate) -> Option<usize>
fn index(&self, coordinate: &Self::Coordinate) -> Option<usize>
Map from coordinate to bin number.
Returns an option as not all valid coordinates are necessarily contained within a bin.
source§fn num_bins(&self) -> usize
fn num_bins(&self) -> usize
The number of bins in this axis, including underflow and overflow.
source§fn bin(&self, index: usize) -> Option<Self::BinInterval>
fn bin(&self, index: usize) -> Option<Self::BinInterval>
Map from bin number to axis to the interval covering the range of coordinates that this bin contains.
Returns an option in case an index >= Axis::num_bins is given.
source§fn iter(&self) -> Box<dyn Iterator<Item = (usize, Self::BinInterval)> + '_>
fn iter(&self) -> Box<dyn Iterator<Item = (usize, Self::BinInterval)> + '_>
An iterator over bin numbers and bin intervals
source§impl<T> Clone for CategoryNoFlow<T>where
T: Eq + Hash + Clone,
impl<T> Clone for CategoryNoFlow<T>where T: Eq + Hash + Clone,
source§fn clone(&self) -> CategoryNoFlow<T>
fn clone(&self) -> CategoryNoFlow<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> Default for CategoryNoFlow<T>where
T: Eq + Hash + Default,
impl<T> Default for CategoryNoFlow<T>where T: Eq + Hash + Default,
source§fn default() -> CategoryNoFlow<T>
fn default() -> CategoryNoFlow<T>
Returns the “default value” for a type. Read more
source§impl<'de, T> Deserialize<'de> for CategoryNoFlow<T>where
T: Eq + Hash + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for CategoryNoFlow<T>where T: Eq + Hash + Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: Display + Value> Display for CategoryNoFlow<T>
impl<T: Display + Value> Display for CategoryNoFlow<T>
source§impl<'a, T: Value> IntoIterator for &'a CategoryNoFlow<T>
impl<'a, T: Value> IntoIterator for &'a CategoryNoFlow<T>
§type Item = (usize, <Category<T> as Axis>::BinInterval)
type Item = (usize, <Category<T> as Axis>::BinInterval)
The type of the elements being iterated over.
§type IntoIter = Box<dyn Iterator<Item = <&'a CategoryNoFlow<T> as IntoIterator>::Item> + 'a, Global>
type IntoIter = Box<dyn Iterator<Item = <&'a CategoryNoFlow<T> as IntoIterator>::Item> + 'a, Global>
Which kind of iterator are we turning this into?
source§impl<T> PartialEq<CategoryNoFlow<T>> for CategoryNoFlow<T>where
T: Eq + Hash + PartialEq,
impl<T> PartialEq<CategoryNoFlow<T>> for CategoryNoFlow<T>where T: Eq + Hash + PartialEq,
source§fn eq(&self, other: &CategoryNoFlow<T>) -> bool
fn eq(&self, other: &CategoryNoFlow<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<T> Eq for CategoryNoFlow<T>where T: Eq + Hash + Eq,
impl<T> StructuralEq for CategoryNoFlow<T>where T: Eq + Hash,
impl<T> StructuralPartialEq for CategoryNoFlow<T>where T: Eq + Hash,
Auto Trait Implementations§
impl<T> RefUnwindSafe for CategoryNoFlow<T>where T: RefUnwindSafe,
impl<T> Send for CategoryNoFlow<T>where T: Send,
impl<T> Sync for CategoryNoFlow<T>where T: Sync,
impl<T> Unpin for CategoryNoFlow<T>where T: Unpin,
impl<T> UnwindSafe for CategoryNoFlow<T>where T: UnwindSafe,
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