pub struct FastSingleIntBinning<T> { /* private fields */ }
Expand description

Generic binning meant for any integer type

Implementations§

source§

impl FastSingleIntBinning<u8>

source

pub const fn new_inclusive(start: u8, end_inclusive: u8) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> u8

Get left border, inclusive

source

pub const fn right(&self) -> u8

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<u8>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = u8>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningU8;
let binning = FastBinningU8::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <u8 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<i8>

source

pub const fn new_inclusive(start: i8, end_inclusive: i8) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> i8

Get left border, inclusive

source

pub const fn right(&self) -> i8

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<i8>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = i8>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningI8;
let binning = FastBinningI8::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <i8 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<u16>

source

pub const fn new_inclusive(start: u16, end_inclusive: u16) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> u16

Get left border, inclusive

source

pub const fn right(&self) -> u16

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<u16>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = u16>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningU16;
let binning = FastBinningU16::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <u16 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<i16>

source

pub const fn new_inclusive(start: i16, end_inclusive: i16) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> i16

Get left border, inclusive

source

pub const fn right(&self) -> i16

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<i16>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = i16>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningI16;
let binning = FastBinningI16::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <i16 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<u32>

source

pub const fn new_inclusive(start: u32, end_inclusive: u32) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> u32

Get left border, inclusive

source

pub const fn right(&self) -> u32

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<u32>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = u32>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningU32;
let binning = FastBinningU32::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <u32 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<i32>

source

pub const fn new_inclusive(start: i32, end_inclusive: i32) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> i32

Get left border, inclusive

source

pub const fn right(&self) -> i32

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<i32>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = i32>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningI32;
let binning = FastBinningI32::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <i32 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<u64>

source

pub const fn new_inclusive(start: u64, end_inclusive: u64) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> u64

Get left border, inclusive

source

pub const fn right(&self) -> u64

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<u64>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = u64>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningU64;
let binning = FastBinningU64::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <u64 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<i64>

source

pub const fn new_inclusive(start: i64, end_inclusive: i64) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> i64

Get left border, inclusive

source

pub const fn right(&self) -> i64

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<i64>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = i64>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningI64;
let binning = FastBinningI64::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <i64 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<u128>

source

pub const fn new_inclusive(start: u128, end_inclusive: u128) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> u128

Get left border, inclusive

source

pub const fn right(&self) -> u128

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<u128>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = u128>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningU128;
let binning = FastBinningU128::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <u128 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<i128>

source

pub const fn new_inclusive(start: i128, end_inclusive: i128) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> i128

Get left border, inclusive

source

pub const fn right(&self) -> i128

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<i128>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = i128>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningI128;
let binning = FastBinningI128::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <i128 as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<usize>

source

pub const fn new_inclusive(start: usize, end_inclusive: usize) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> usize

Get left border, inclusive

source

pub const fn right(&self) -> usize

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<usize>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = usize>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningUSIZE;
let binning = FastBinningUSIZE::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <usize as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

source§

impl FastSingleIntBinning<isize>

source

pub const fn new_inclusive(start: isize, end_inclusive: isize) -> Self

Create a new Binning
  • both borders are inclusive
  • each bin has width 1
Panics
  • if start is smaller than end_inclusive TODO Think about if this should actually panic or return None
source

pub const fn left(&self) -> isize

Get left border, inclusive

source

pub const fn right(&self) -> isize

Get right border, inclusive

source

pub const fn range_inclusive(&self) -> RangeInclusive<isize>

source

pub fn single_valued_bin_iter(&self) -> impl Iterator<Item = isize>

Iterator over all the bins

Since the bins have width 1, a bin can be defined by its corresponding value which we can iterate over.

Example
use sampling::histogram::FastBinningISIZE;
let binning = FastBinningISIZE::new_inclusive(2,5);
let vec: Vec<_> = binning.single_valued_bin_iter().collect();
assert_eq!(&vec, &[2, 3, 4, 5]);
source

pub fn bins_m1(&self) -> <isize as HasUnsignedVersion>::Unsigned

The amount of bins -1
  • minus 1 because if the bins are going over the entire range of the type, then I 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

Trait Implementations§

source§

impl<T: Clone> Clone for FastSingleIntBinning<T>

source§

fn clone(&self) -> FastSingleIntBinning<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for FastSingleIntBinning<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, T> Deserialize<'de> for FastSingleIntBinning<T>
where T: Deserialize<'de>,

source§

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: Ord> Ord for FastSingleIntBinning<T>

source§

fn cmp(&self, other: &FastSingleIntBinning<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: PartialEq> PartialEq for FastSingleIntBinning<T>

source§

fn eq(&self, other: &FastSingleIntBinning<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd> PartialOrd for FastSingleIntBinning<T>

source§

fn partial_cmp(&self, other: &FastSingleIntBinning<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> Serialize for FastSingleIntBinning<T>
where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Copy> Copy for FastSingleIntBinning<T>

source§

impl<T: Eq> Eq for FastSingleIntBinning<T>

source§

impl<T> StructuralEq for FastSingleIntBinning<T>

source§

impl<T> StructuralPartialEq for FastSingleIntBinning<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for FastSingleIntBinning<T>
where T: RefUnwindSafe,

§

impl<T> Send for FastSingleIntBinning<T>
where T: Send,

§

impl<T> Sync for FastSingleIntBinning<T>
where T: Sync,

§

impl<T> Unpin for FastSingleIntBinning<T>
where T: Unpin,

§

impl<T> UnwindSafe for FastSingleIntBinning<T>
where T: UnwindSafe,

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
§

impl<S, T> Cast<T> for S
where T: Conv<S>,

§

fn cast(self) -> T

Cast from Self to T Read more
§

fn try_cast(self) -> Result<T, Error>

Try converting from Self to T Read more
§

impl<S, T> CastApprox<T> for S
where T: ConvApprox<S>,

§

fn try_cast_approx(self) -> Result<T, Error>

Try approximate conversion from Self to T Read more
§

fn cast_approx(self) -> T

Cast approximately from Self to T Read more
§

impl<S, T> CastFloat<T> for S
where T: ConvFloat<S>,

§

fn cast_trunc(self) -> T

Cast to integer, truncating Read more
§

fn cast_nearest(self) -> T

Cast to the nearest integer Read more
§

fn cast_floor(self) -> T

Cast the floor to an integer Read more
§

fn cast_ceil(self) -> T

Cast the ceiling to an integer Read more
§

fn try_cast_trunc(self) -> Result<T, Error>

Try converting to integer with truncation Read more
§

fn try_cast_nearest(self) -> Result<T, Error>

Try converting to the nearest integer Read more
§

fn try_cast_floor(self) -> Result<T, Error>

Try converting the floor to an integer Read more
§

fn try_cast_ceil(self) -> Result<T, Error>

Try convert the ceiling to an integer 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,