pub struct CategoryNoFlow<T>{ /* 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>
Source§type Coordinate = T
type Coordinate = T
The type representing a location on this axis.
Source§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>
impl<T> Clone for CategoryNoFlow<T>
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> Debug for CategoryNoFlow<T>
impl<T> Debug for CategoryNoFlow<T>
Source§impl<T> Default for CategoryNoFlow<T>
impl<T> Default for CategoryNoFlow<T>
Source§fn default() -> CategoryNoFlow<T>
fn default() -> CategoryNoFlow<T>
Returns the “default value” for a type. 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>
Source§type Item = (usize, <Category<T> as Axis>::BinInterval)
type Item = (usize, <Category<T> as Axis>::BinInterval)
The type of the elements being iterated over.
Source§type IntoIter = Box<dyn Iterator<Item = <&'a CategoryNoFlow<T> as IntoIterator>::Item> + 'a>
type IntoIter = Box<dyn Iterator<Item = <&'a CategoryNoFlow<T> as IntoIterator>::Item> + 'a>
Which kind of iterator are we turning this into?
Source§impl<T> PartialEq for CategoryNoFlow<T>
impl<T> PartialEq for CategoryNoFlow<T>
impl<T> Eq for CategoryNoFlow<T>
impl<T> StructuralPartialEq for CategoryNoFlow<T>
Auto Trait Implementations§
impl<T> Freeze for CategoryNoFlow<T>
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