pub struct BinningWithWidth<T>where
T: HasUnsignedVersion,{ /* private fields */ }
Expand description
Generic binning meant for any integer type
Implementations§
Source§impl BinningWithWidth<u8>
impl BinningWithWidth<u8>
Sourcepub fn new_inclusive(
start: u8,
end_inclusive: u8,
bin_width: u8,
) -> Result<Self, <u8 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: u8, end_inclusive: u8, bin_width: u8, ) -> Result<Self, <u8 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<u8>
pub const fn range_inclusive(&self) -> RangeInclusive<u8>
§Returns the range covered by the bins as a RangeInclusive<u8>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u8>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u8>>
Sourcepub fn bins_m1(&self) -> <u8 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <u8 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<u8>>(
&self,
val: V,
) -> Option<<u8 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<u8>>( &self, val: V, ) -> Option<<u8 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<i8>
impl BinningWithWidth<i8>
Sourcepub fn new_inclusive(
start: i8,
end_inclusive: i8,
bin_width: i8,
) -> Result<Self, <i8 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: i8, end_inclusive: i8, bin_width: i8, ) -> Result<Self, <i8 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<i8>
pub const fn range_inclusive(&self) -> RangeInclusive<i8>
§Returns the range covered by the bins as a RangeInclusive<i8>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i8>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i8>>
Sourcepub fn bins_m1(&self) -> <i8 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <i8 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<i8>>(
&self,
val: V,
) -> Option<<i8 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<i8>>( &self, val: V, ) -> Option<<i8 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<u16>
impl BinningWithWidth<u16>
Sourcepub fn new_inclusive(
start: u16,
end_inclusive: u16,
bin_width: u16,
) -> Result<Self, <u16 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: u16, end_inclusive: u16, bin_width: u16, ) -> Result<Self, <u16 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<u16>
pub const fn range_inclusive(&self) -> RangeInclusive<u16>
§Returns the range covered by the bins as a RangeInclusive<u16>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u16>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u16>>
Sourcepub fn bins_m1(&self) -> <u16 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <u16 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<u16>>(
&self,
val: V,
) -> Option<<u16 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<u16>>( &self, val: V, ) -> Option<<u16 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<i16>
impl BinningWithWidth<i16>
Sourcepub fn new_inclusive(
start: i16,
end_inclusive: i16,
bin_width: i16,
) -> Result<Self, <i16 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: i16, end_inclusive: i16, bin_width: i16, ) -> Result<Self, <i16 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<i16>
pub const fn range_inclusive(&self) -> RangeInclusive<i16>
§Returns the range covered by the bins as a RangeInclusive<i16>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i16>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i16>>
Sourcepub fn bins_m1(&self) -> <i16 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <i16 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<i16>>(
&self,
val: V,
) -> Option<<i16 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<i16>>( &self, val: V, ) -> Option<<i16 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<u32>
impl BinningWithWidth<u32>
Sourcepub fn new_inclusive(
start: u32,
end_inclusive: u32,
bin_width: u32,
) -> Result<Self, <u32 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: u32, end_inclusive: u32, bin_width: u32, ) -> Result<Self, <u32 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<u32>
pub const fn range_inclusive(&self) -> RangeInclusive<u32>
§Returns the range covered by the bins as a RangeInclusive<u32>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u32>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u32>>
Sourcepub fn bins_m1(&self) -> <u32 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <u32 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<u32>>(
&self,
val: V,
) -> Option<<u32 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<u32>>( &self, val: V, ) -> Option<<u32 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<i32>
impl BinningWithWidth<i32>
Sourcepub fn new_inclusive(
start: i32,
end_inclusive: i32,
bin_width: i32,
) -> Result<Self, <i32 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: i32, end_inclusive: i32, bin_width: i32, ) -> Result<Self, <i32 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<i32>
pub const fn range_inclusive(&self) -> RangeInclusive<i32>
§Returns the range covered by the bins as a RangeInclusive<i32>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i32>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i32>>
Sourcepub fn bins_m1(&self) -> <i32 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <i32 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<i32>>(
&self,
val: V,
) -> Option<<i32 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<i32>>( &self, val: V, ) -> Option<<i32 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<u64>
impl BinningWithWidth<u64>
Sourcepub fn new_inclusive(
start: u64,
end_inclusive: u64,
bin_width: u64,
) -> Result<Self, <u64 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: u64, end_inclusive: u64, bin_width: u64, ) -> Result<Self, <u64 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<u64>
pub const fn range_inclusive(&self) -> RangeInclusive<u64>
§Returns the range covered by the bins as a RangeInclusive<u64>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u64>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u64>>
Sourcepub fn bins_m1(&self) -> <u64 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <u64 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<u64>>(
&self,
val: V,
) -> Option<<u64 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<u64>>( &self, val: V, ) -> Option<<u64 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<i64>
impl BinningWithWidth<i64>
Sourcepub fn new_inclusive(
start: i64,
end_inclusive: i64,
bin_width: i64,
) -> Result<Self, <i64 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: i64, end_inclusive: i64, bin_width: i64, ) -> Result<Self, <i64 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<i64>
pub const fn range_inclusive(&self) -> RangeInclusive<i64>
§Returns the range covered by the bins as a RangeInclusive<i64>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i64>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i64>>
Sourcepub fn bins_m1(&self) -> <i64 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <i64 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<i64>>(
&self,
val: V,
) -> Option<<i64 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<i64>>( &self, val: V, ) -> Option<<i64 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<u128>
impl BinningWithWidth<u128>
Sourcepub fn new_inclusive(
start: u128,
end_inclusive: u128,
bin_width: u128,
) -> Result<Self, <u128 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: u128, end_inclusive: u128, bin_width: u128, ) -> Result<Self, <u128 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<u128>
pub const fn range_inclusive(&self) -> RangeInclusive<u128>
§Returns the range covered by the bins as a RangeInclusive<u128>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u128>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<u128>>
Sourcepub fn bins_m1(&self) -> <u128 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <u128 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<u128>>(
&self,
val: V,
) -> Option<<u128 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<u128>>( &self, val: V, ) -> Option<<u128 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<i128>
impl BinningWithWidth<i128>
Sourcepub fn new_inclusive(
start: i128,
end_inclusive: i128,
bin_width: i128,
) -> Result<Self, <i128 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: i128, end_inclusive: i128, bin_width: i128, ) -> Result<Self, <i128 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<i128>
pub const fn range_inclusive(&self) -> RangeInclusive<i128>
§Returns the range covered by the bins as a RangeInclusive<i128>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i128>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i128>>
Sourcepub fn bins_m1(&self) -> <i128 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <i128 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<i128>>(
&self,
val: V,
) -> Option<<i128 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<i128>>( &self, val: V, ) -> Option<<i128 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<usize>
impl BinningWithWidth<usize>
Sourcepub fn new_inclusive(
start: usize,
end_inclusive: usize,
bin_width: usize,
) -> Result<Self, <usize as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: usize, end_inclusive: usize, bin_width: usize, ) -> Result<Self, <usize as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<usize>
pub const fn range_inclusive(&self) -> RangeInclusive<usize>
§Returns the range covered by the bins as a RangeInclusive<usize>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<usize>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<usize>>
Sourcepub fn bins_m1(&self) -> <usize as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <usize as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<usize>>(
&self,
val: V,
) -> Option<<usize as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<usize>>( &self, val: V, ) -> Option<<usize as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Source§impl BinningWithWidth<isize>
impl BinningWithWidth<isize>
Sourcepub fn new_inclusive(
start: isize,
end_inclusive: isize,
bin_width: isize,
) -> Result<Self, <isize as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: isize, end_inclusive: isize, bin_width: isize, ) -> Result<Self, <isize as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<isize>
pub const fn range_inclusive(&self) -> RangeInclusive<isize>
§Returns the range covered by the bins as a RangeInclusive<isize>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<isize>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<isize>>
Sourcepub fn bins_m1(&self) -> <isize as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <isize as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<isize>>(
&self,
val: V,
) -> Option<<isize as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<isize>>( &self, val: V, ) -> Option<<isize as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Trait Implementations§
Source§impl<T> Clone for BinningWithWidth<T>
impl<T> Clone for BinningWithWidth<T>
Source§fn clone(&self) -> BinningWithWidth<T>
fn clone(&self) -> BinningWithWidth<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T> Debug for BinningWithWidth<T>
impl<T> Debug for BinningWithWidth<T>
Source§impl<'de, T> Deserialize<'de> for BinningWithWidth<T>
impl<'de, T> Deserialize<'de> for BinningWithWidth<T>
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>,
Source§impl<T> PartialEq for BinningWithWidth<T>
impl<T> PartialEq for BinningWithWidth<T>
Source§impl<T> Serialize for BinningWithWidth<T>
impl<T> Serialize for BinningWithWidth<T>
impl<T> Eq for BinningWithWidth<T>
impl<T> StructuralPartialEq for BinningWithWidth<T>where
T: HasUnsignedVersion,
Auto Trait Implementations§
impl<T> Freeze for BinningWithWidth<T>
impl<T> RefUnwindSafe for BinningWithWidth<T>
impl<T> Send for BinningWithWidth<T>
impl<T> Sync for BinningWithWidth<T>
impl<T> Unpin for BinningWithWidth<T>
impl<T> UnwindSafe for BinningWithWidth<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more