pub struct UnitInterval<T = f32>(/* private fields */);Expand description
A floating-point value constrained to the closed unit interval [0, 1].
UnitInterval is useful for normalized values such as opacity, progress,
ratios, blend factors, and percentages represented as fractions.
The default backing type is f32; use UnitInterval<f64> when you need a
wider float.
§Examples
use unit_intervals::UnitInterval;
let progress = UnitInterval::new(0.75).unwrap();
assert_eq!(progress.get(), 0.75);
assert_eq!(UnitInterval::new(1.25), None);Implementations§
Source§impl<T: UnitIntervalFloat> UnitInterval<T>
impl<T: UnitIntervalFloat> UnitInterval<T>
Sourcepub const ZERO: Self
pub const ZERO: Self
The lower bound of the unit interval.
§Examples
use unit_intervals::UnitInterval;
assert_eq!(UnitInterval::<f32>::ZERO.get(), 0.0);Sourcepub const ONE: Self
pub const ONE: Self
The upper bound of the unit interval.
§Examples
use unit_intervals::UnitInterval;
assert_eq!(UnitInterval::<f32>::ONE.get(), 1.0);Sourcepub const HALF: Self
pub const HALF: Self
The midpoint of the unit interval.
§Examples
use unit_intervals::UnitInterval;
assert_eq!(UnitInterval::<f32>::HALF.get(), 0.5);Sourcepub fn new(v: T) -> Option<Self>
pub fn new(v: T) -> Option<Self>
Creates a value if v is inside [0, 1].
Returns None for values outside the interval and for NaN.
§Examples
use unit_intervals::UnitInterval;
assert_eq!(UnitInterval::<f32>::new(0.25).unwrap().get(), 0.25);
assert_eq!(UnitInterval::<f32>::new(-0.25), None);
assert_eq!(UnitInterval::<f32>::new(f32::NAN), None);Sourcepub const unsafe fn new_unchecked(v: T) -> Self
Available on crate feature unsafe only.
pub const unsafe fn new_unchecked(v: T) -> Self
unsafe only.Creates a value without checking that v is inside [0, 1].
§Safety
The caller must guarantee that v is greater than or equal to zero,
less than or equal to one, and not NaN.
Sourcepub fn contains(v: T) -> bool
pub fn contains(v: T) -> bool
Returns whether v is inside [0, 1].
NaN is not contained in the interval.
§Examples
use unit_intervals::UnitInterval;
assert!(UnitInterval::<f32>::contains(0.5));
assert!(!UnitInterval::<f32>::contains(1.5));
assert!(!UnitInterval::<f32>::contains(f32::NAN));Sourcepub fn saturating(v: T) -> Self
pub fn saturating(v: T) -> Self
Creates a value by clamping v into [0, 1].
NaN is treated as zero.
§Examples
use unit_intervals::UnitInterval;
assert_eq!(UnitInterval::<f32>::saturating(-0.25).get(), 0.0);
assert_eq!(UnitInterval::<f32>::saturating(1.25).get(), 1.0);
assert_eq!(UnitInterval::<f32>::saturating(f32::NAN).get(), 0.0);Sourcepub const fn get(self) -> T
pub const fn get(self) -> T
Returns the inner floating-point value.
§Examples
use unit_intervals::UnitInterval;
let value = UnitInterval::new(0.25).unwrap();
assert_eq!(value.get(), 0.25);Sourcepub const fn into_inner(self) -> T
pub const fn into_inner(self) -> T
Consumes the wrapper and returns the inner floating-point value.
§Examples
use unit_intervals::UnitInterval;
let value = UnitInterval::new(0.25).unwrap();
assert_eq!(value.into_inner(), 0.25);Sourcepub fn is_zero(self) -> bool
pub fn is_zero(self) -> bool
Returns whether this value is exactly zero.
§Examples
use unit_intervals::UnitInterval;
assert!(UnitInterval::<f32>::ZERO.is_zero());
assert!(!UnitInterval::<f32>::HALF.is_zero());Sourcepub fn is_one(self) -> bool
pub fn is_one(self) -> bool
Returns whether this value is exactly one.
§Examples
use unit_intervals::UnitInterval;
assert!(UnitInterval::<f32>::ONE.is_one());
assert!(!UnitInterval::<f32>::HALF.is_one());Sourcepub fn complement(self) -> Self
pub fn complement(self) -> Self
Returns 1 - self.
§Examples
use unit_intervals::UnitInterval;
let value = UnitInterval::new(0.25).unwrap();
assert_eq!(value.complement().get(), 0.75);Sourcepub fn min(self, rhs: Self) -> Self
pub fn min(self, rhs: Self) -> Self
Returns the smaller of two unit interval values.
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(low.min(high), low);Sourcepub fn max(self, rhs: Self) -> Self
pub fn max(self, rhs: Self) -> Self
Returns the larger of two unit interval values.
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(low.max(high), high);Sourcepub fn midpoint(self, rhs: Self) -> Self
pub fn midpoint(self, rhs: Self) -> Self
Returns the midpoint between two unit interval values.
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(low.midpoint(high).get(), 0.5);Sourcepub fn distance_to(self, rhs: Self) -> Self
pub fn distance_to(self, rhs: Self) -> Self
Returns the absolute distance between two unit interval values.
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(low.distance_to(high).get(), 0.5);
assert_eq!(high.distance_to(low).get(), 0.5);Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Adds two values, returning None if the result is outside [0, 1].
§Examples
use unit_intervals::UnitInterval;
let a = UnitInterval::new(0.25).unwrap();
let b = UnitInterval::new(0.75).unwrap();
assert_eq!(a.checked_add(a).unwrap().get(), 0.5);
assert_eq!(b.checked_add(b), None);Sourcepub unsafe fn add_unchecked(self, rhs: Self) -> Self
Available on crate feature unsafe only.
pub unsafe fn add_unchecked(self, rhs: Self) -> Self
unsafe only.Adds two values without checking that the result is inside [0, 1].
§Safety
The caller must guarantee that self + rhs is inside [0, 1] and not
NaN.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Adds two values and clamps the result into [0, 1].
§Examples
use unit_intervals::UnitInterval;
let value = UnitInterval::new(0.75).unwrap();
assert_eq!(value.saturating_add(value).get(), 1.0);Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Subtracts rhs, returning None if the result is outside [0, 1].
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(high.checked_sub(low).unwrap().get(), 0.5);
assert_eq!(low.checked_sub(high), None);Sourcepub unsafe fn sub_unchecked(self, rhs: Self) -> Self
Available on crate feature unsafe only.
pub unsafe fn sub_unchecked(self, rhs: Self) -> Self
unsafe only.Subtracts rhs without checking that the result is inside [0, 1].
§Safety
The caller must guarantee that self - rhs is inside [0, 1] and not
NaN.
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Subtracts rhs and clamps the result into [0, 1].
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(low.saturating_sub(high).get(), 0.0);Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Divides by rhs, returning None if the result is outside [0, 1].
Division by zero follows the backing float semantics and produces
None, because infinity is outside the unit interval.
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(low.checked_div(high).unwrap().get(), 1.0 / 3.0);
assert_eq!(high.checked_div(low), None);
assert_eq!(high.checked_div(UnitInterval::ZERO), None);Sourcepub unsafe fn div_unchecked(self, rhs: Self) -> Self
Available on crate feature unsafe only.
pub unsafe fn div_unchecked(self, rhs: Self) -> Self
unsafe only.Divides by rhs without checking that the result is inside [0, 1].
§Safety
The caller must guarantee that self / rhs is inside [0, 1] and not
NaN.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Divides by rhs and clamps the result into [0, 1].
Division by zero follows the backing float semantics and saturates to
one for positive infinity, or zero for 0 / 0.
§Examples
use unit_intervals::UnitInterval;
let low = UnitInterval::new(0.25).unwrap();
let high = UnitInterval::new(0.75).unwrap();
assert_eq!(high.saturating_div(low).get(), 1.0);
assert_eq!(low.saturating_div(UnitInterval::ZERO).get(), 1.0);Sourcepub fn checked_scale(self, factor: T) -> Option<Self>
pub fn checked_scale(self, factor: T) -> Option<Self>
Multiplies by an arbitrary float, returning None if the result is
outside [0, 1].
Use the * operator when multiplying by another UnitInterval, since
that operation always stays inside the interval.
§Examples
use unit_intervals::UnitInterval;
let value = UnitInterval::new(0.25).unwrap();
assert_eq!(value.checked_scale(2.0).unwrap().get(), 0.5);
assert_eq!(value.checked_scale(8.0), None);Sourcepub unsafe fn scale_unchecked(self, factor: T) -> Self
Available on crate feature unsafe only.
pub unsafe fn scale_unchecked(self, factor: T) -> Self
unsafe only.Multiplies by an arbitrary float without checking that the result is
inside [0, 1].
§Safety
The caller must guarantee that self * factor is inside [0, 1] and
not NaN.
Sourcepub fn saturating_scale(self, factor: T) -> Self
pub fn saturating_scale(self, factor: T) -> Self
Multiplies by an arbitrary float and clamps the result into [0, 1].
Use the * operator when multiplying by another UnitInterval, since
that operation always stays inside the interval.
§Examples
use unit_intervals::UnitInterval;
let value = UnitInterval::new(0.75).unwrap();
assert_eq!(value.saturating_scale(2.0).get(), 1.0);
assert_eq!(value.saturating_scale(-1.0).get(), 0.0);Sourcepub fn lerp(self, start: T, end: T) -> T
pub fn lerp(self, start: T, end: T) -> T
Linearly interpolates between start and end.
A value of zero returns start, one returns end, and values between
zero and one return the corresponding point between them.
§Examples
use unit_intervals::UnitInterval;
assert_eq!(UnitInterval::<f32>::ZERO.lerp(10.0, 20.0), 10.0);
assert_eq!(UnitInterval::<f32>::HALF.lerp(10.0, 20.0), 15.0);
assert_eq!(UnitInterval::<f32>::ONE.lerp(10.0, 20.0), 20.0);Source§impl UnitInterval<f32>
impl UnitInterval<f32>
Sourcepub fn is_sign_positive(self) -> bool
pub fn is_sign_positive(self) -> bool
Returns true if this value is positive zero.
Sourcepub fn is_sign_negative(self) -> bool
pub fn is_sign_negative(self) -> bool
Returns true if this value is negative zero.
Sourcepub fn is_infinite(self) -> bool
pub fn is_infinite(self) -> bool
Returns false; unit interval values cannot be infinite.
Source§impl UnitInterval<f32>
impl UnitInterval<f32>
Sourcepub fn floor(self) -> Self
Available on crate features std only.
pub fn floor(self) -> Self
std only.Returns the largest integer less than or equal to this value.
Sourcepub fn ceil(self) -> Self
Available on crate features std only.
pub fn ceil(self) -> Self
std only.Returns the smallest integer greater than or equal to this value.
Sourcepub fn round(self) -> Self
Available on crate features std only.
pub fn round(self) -> Self
std only.Returns the nearest integer to this value, rounding halfway cases away from zero.
Sourcepub fn trunc(self) -> Self
Available on crate features std only.
pub fn trunc(self) -> Self
std only.Returns the integer part of this value.
Sourcepub fn fract(self) -> Self
Available on crate features std only.
pub fn fract(self) -> Self
std only.Returns the fractional part of this value.
Sourcepub fn powi(self, n: i32) -> f32
Available on crate features std only.
pub fn powi(self, n: i32) -> f32
std only.Raises this value to an integer power.
Sourcepub fn powf(self, n: f32) -> f32
Available on crate features std only.
pub fn powf(self, n: f32) -> f32
std only.Raises this value to a floating-point power.
Sourcepub fn mul_add(self, a: f32, b: f32) -> f32
Available on crate features std only.
pub fn mul_add(self, a: f32, b: f32) -> f32
std only.Computes self * a + b with one rounding error.
Sourcepub fn div_euclid(self, rhs: f32) -> f32
Available on crate features std only.
pub fn div_euclid(self, rhs: f32) -> f32
std only.Returns the Euclidean division of this value by rhs.
Sourcepub fn rem_euclid(self, rhs: f32) -> f32
Available on crate features std only.
pub fn rem_euclid(self, rhs: f32) -> f32
std only.Returns the least non-negative remainder of this value divided by rhs.
Sourcepub fn log(self, base: f32) -> f32
Available on crate features std only.
pub fn log(self, base: f32) -> f32
std only.Returns the logarithm with respect to an arbitrary base.
Sourcepub fn sin_cos(self) -> (f32, f32)
Available on crate features std only.
pub fn sin_cos(self) -> (f32, f32)
std only.Returns both sine and cosine, in radians.
Sourcepub fn acos(self) -> f32
Available on crate features std only.
pub fn acos(self) -> f32
std only.Returns the arccosine, in radians.
Sourcepub fn atan(self) -> Self
Available on crate features std only.
pub fn atan(self) -> Self
std only.Returns the arctangent, in radians.
Sourcepub fn atan2(self, other: f32) -> f32
Available on crate features std only.
pub fn atan2(self, other: f32) -> f32
std only.Returns the four-quadrant arctangent of self and other, in radians.
Sourcepub fn asinh(self) -> Self
Available on crate features std only.
pub fn asinh(self) -> Self
std only.Returns the inverse hyperbolic sine.
Sourcepub fn acosh(self) -> f32
Available on crate features std only.
pub fn acosh(self) -> f32
std only.Returns the inverse hyperbolic cosine.
Source§impl UnitInterval<f64>
impl UnitInterval<f64>
Sourcepub fn is_sign_positive(self) -> bool
pub fn is_sign_positive(self) -> bool
Returns true if this value is positive zero.
Sourcepub fn is_sign_negative(self) -> bool
pub fn is_sign_negative(self) -> bool
Returns true if this value is negative zero.
Sourcepub fn is_infinite(self) -> bool
pub fn is_infinite(self) -> bool
Returns false; unit interval values cannot be infinite.
Source§impl UnitInterval<f64>
impl UnitInterval<f64>
Sourcepub fn floor(self) -> Self
Available on crate features std only.
pub fn floor(self) -> Self
std only.Returns the largest integer less than or equal to this value.
Sourcepub fn ceil(self) -> Self
Available on crate features std only.
pub fn ceil(self) -> Self
std only.Returns the smallest integer greater than or equal to this value.
Sourcepub fn round(self) -> Self
Available on crate features std only.
pub fn round(self) -> Self
std only.Returns the nearest integer to this value, rounding halfway cases away from zero.
Sourcepub fn trunc(self) -> Self
Available on crate features std only.
pub fn trunc(self) -> Self
std only.Returns the integer part of this value.
Sourcepub fn fract(self) -> Self
Available on crate features std only.
pub fn fract(self) -> Self
std only.Returns the fractional part of this value.
Sourcepub fn powi(self, n: i32) -> f64
Available on crate features std only.
pub fn powi(self, n: i32) -> f64
std only.Raises this value to an integer power.
Sourcepub fn powf(self, n: f64) -> f64
Available on crate features std only.
pub fn powf(self, n: f64) -> f64
std only.Raises this value to a floating-point power.
Sourcepub fn mul_add(self, a: f64, b: f64) -> f64
Available on crate features std only.
pub fn mul_add(self, a: f64, b: f64) -> f64
std only.Computes self * a + b with one rounding error.
Sourcepub fn div_euclid(self, rhs: f64) -> f64
Available on crate features std only.
pub fn div_euclid(self, rhs: f64) -> f64
std only.Returns the Euclidean division of this value by rhs.
Sourcepub fn rem_euclid(self, rhs: f64) -> f64
Available on crate features std only.
pub fn rem_euclid(self, rhs: f64) -> f64
std only.Returns the least non-negative remainder of this value divided by rhs.
Sourcepub fn log(self, base: f64) -> f64
Available on crate features std only.
pub fn log(self, base: f64) -> f64
std only.Returns the logarithm with respect to an arbitrary base.
Sourcepub fn sin_cos(self) -> (f64, f64)
Available on crate features std only.
pub fn sin_cos(self) -> (f64, f64)
std only.Returns both sine and cosine, in radians.
Sourcepub fn acos(self) -> f64
Available on crate features std only.
pub fn acos(self) -> f64
std only.Returns the arccosine, in radians.
Sourcepub fn atan(self) -> Self
Available on crate features std only.
pub fn atan(self) -> Self
std only.Returns the arctangent, in radians.
Sourcepub fn atan2(self, other: f64) -> f64
Available on crate features std only.
pub fn atan2(self, other: f64) -> f64
std only.Returns the four-quadrant arctangent of self and other, in radians.
Sourcepub fn asinh(self) -> Self
Available on crate features std only.
pub fn asinh(self) -> Self
std only.Returns the inverse hyperbolic sine.
Sourcepub fn acosh(self) -> f64
Available on crate features std only.
pub fn acosh(self) -> f64
std only.Returns the inverse hyperbolic cosine.
Trait Implementations§
Source§impl Add<SignedUnitInterval<f64>> for UnitInterval<f64>
impl Add<SignedUnitInterval<f64>> for UnitInterval<f64>
Source§impl Add<SignedUnitInterval> for UnitInterval<f32>
impl Add<SignedUnitInterval> for UnitInterval<f32>
Source§impl Add<UnitInterval<f64>> for SignedUnitInterval<f64>
impl Add<UnitInterval<f64>> for SignedUnitInterval<f64>
Source§impl Add<UnitInterval> for SignedUnitInterval<f32>
impl Add<UnitInterval> for SignedUnitInterval<f32>
Source§impl Add<UnitInterval> for f32
impl Add<UnitInterval> for f32
Source§impl Add for UnitInterval<f32>
impl Add for UnitInterval<f32>
Source§impl Add for UnitInterval<f64>
impl Add for UnitInterval<f64>
Source§impl<'a> Arbitrary<'a> for UnitInterval<f32>
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for UnitInterval<f32>
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<'a> Arbitrary<'a> for UnitInterval<f64>
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for UnitInterval<f64>
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<T> Archive for UnitInterval<T>where
T: Archive,
impl<T> Archive for UnitInterval<T>where
T: Archive,
Source§type Resolver = UnitIntervalResolver<T>
type Resolver = UnitIntervalResolver<T>
Source§fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
Source§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
serialize. Read moreSource§impl AsPrimitive<UnitInterval<f64>> for UnitInterval<f32>
Available on crate feature num-traits only.
impl AsPrimitive<UnitInterval<f64>> for UnitInterval<f32>
num-traits only.Source§fn as_(self) -> UnitInterval<f64>
fn as_(self) -> UnitInterval<f64>
as operator.Source§impl AsPrimitive<UnitInterval<f64>> for UnitInterval<f64>
Available on crate feature num-traits only.
impl AsPrimitive<UnitInterval<f64>> for UnitInterval<f64>
num-traits only.Source§fn as_(self) -> UnitInterval<f64>
fn as_(self) -> UnitInterval<f64>
as operator.Source§impl AsPrimitive<UnitInterval> for UnitInterval<f32>
Available on crate feature num-traits only.
impl AsPrimitive<UnitInterval> for UnitInterval<f32>
num-traits only.Source§fn as_(self) -> UnitInterval<f32>
fn as_(self) -> UnitInterval<f32>
as operator.Source§impl AsPrimitive<UnitInterval> for UnitInterval<f64>
Available on crate feature num-traits only.
impl AsPrimitive<UnitInterval> for UnitInterval<f64>
num-traits only.Source§fn as_(self) -> UnitInterval<f32>
fn as_(self) -> UnitInterval<f32>
as operator.Source§impl AsPrimitive<f32> for UnitInterval<f32>
Available on crate feature num-traits only.
impl AsPrimitive<f32> for UnitInterval<f32>
num-traits only.Source§impl AsPrimitive<f32> for UnitInterval<f64>
Available on crate feature num-traits only.
impl AsPrimitive<f32> for UnitInterval<f64>
num-traits only.Source§impl AsPrimitive<f64> for UnitInterval<f32>
Available on crate feature num-traits only.
impl AsPrimitive<f64> for UnitInterval<f32>
num-traits only.Source§impl AsPrimitive<f64> for UnitInterval<f64>
Available on crate feature num-traits only.
impl AsPrimitive<f64> for UnitInterval<f64>
num-traits only.Source§impl<T> AsRef<T> for UnitInterval<T>
Borrows the inner floating-point value.
impl<T> AsRef<T> for UnitInterval<T>
Borrows the inner floating-point value.
Source§impl Bounded for UnitInterval<f32>
Available on crate feature num-traits only.
impl Bounded for UnitInterval<f32>
num-traits only.Source§impl Bounded for UnitInterval<f64>
Available on crate feature num-traits only.
impl Bounded for UnitInterval<f64>
num-traits only.Source§impl<T> CheckedBitPattern for UnitInterval<T>where
T: UnitIntervalFloat + AnyBitPattern,
Available on crate feature bytemuck only.
impl<T> CheckedBitPattern for UnitInterval<T>where
T: UnitIntervalFloat + AnyBitPattern,
bytemuck only.Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(bits: &Self::Bits) -> bool
fn is_valid_bit_pattern(bits: &Self::Bits) -> bool
bits
as &Self.Source§impl CheckedMul for UnitInterval<f32>
Available on crate feature num-traits only.
impl CheckedMul for UnitInterval<f32>
num-traits only.Source§fn checked_mul(&self, v: &Self) -> Option<Self>
fn checked_mul(&self, v: &Self) -> Option<Self>
None is returned.Source§impl CheckedMul for UnitInterval<f64>
Available on crate feature num-traits only.
impl CheckedMul for UnitInterval<f64>
num-traits only.Source§fn checked_mul(&self, v: &Self) -> Option<Self>
fn checked_mul(&self, v: &Self) -> Option<Self>
None is returned.Source§impl<T: Clone> Clone for UnitInterval<T>
impl<T: Clone> Clone for UnitInterval<T>
Source§fn clone(&self) -> UnitInterval<T>
fn clone(&self) -> UnitInterval<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConstOne for UnitInterval<f32>
Available on crate feature num-traits only.
impl ConstOne for UnitInterval<f32>
num-traits only.Source§impl ConstOne for UnitInterval<f64>
Available on crate feature num-traits only.
impl ConstOne for UnitInterval<f64>
num-traits only.Source§impl<T: Debug> Debug for UnitInterval<T>
impl<T: Debug> Debug for UnitInterval<T>
Source§impl<T: UnitIntervalFloat> Default for UnitInterval<T>
Returns UnitInterval::ZERO.
impl<T: UnitIntervalFloat> Default for UnitInterval<T>
Returns UnitInterval::ZERO.
Source§impl<T> Deref for UnitInterval<T>
Dereferences to the inner floating-point value.
impl<T> Deref for UnitInterval<T>
Dereferences to the inner floating-point value.
Source§impl<'de, T> Deserialize<'de> for UnitInterval<T>where
T: UnitIntervalFloat + Deserialize<'de>,
Available on crate feature serde only.
impl<'de, T> Deserialize<'de> for UnitInterval<T>where
T: UnitIntervalFloat + Deserialize<'de>,
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl<T, D> Distribution<UnitInterval<T>> for SaturatingUnitIntervalDistribution<D>where
T: UnitIntervalFloat,
D: Distribution<T>,
Available on crate feature rand_distr only.
impl<T, D> Distribution<UnitInterval<T>> for SaturatingUnitIntervalDistribution<D>where
T: UnitIntervalFloat,
D: Distribution<T>,
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<T>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<T>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl<T> Distribution<UnitInterval<T>> for StandardUniform
Available on crate feature rand_distr only.
impl<T> Distribution<UnitInterval<T>> for StandardUniform
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<T>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<T>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl Distribution<UnitInterval<f64>> for Beta<f64>
Available on crate feature rand_distr only.
impl Distribution<UnitInterval<f64>> for Beta<f64>
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f64>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f64>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl Distribution<UnitInterval<f64>> for Open01
Available on crate feature rand_distr only.
impl Distribution<UnitInterval<f64>> for Open01
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f64>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f64>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl Distribution<UnitInterval<f64>> for OpenClosed01
Available on crate feature rand_distr only.
impl Distribution<UnitInterval<f64>> for OpenClosed01
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f64>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f64>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl Distribution<UnitInterval> for Beta<f32>
Available on crate feature rand_distr only.
impl Distribution<UnitInterval> for Beta<f32>
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f32>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f32>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl Distribution<UnitInterval> for Open01
Available on crate feature rand_distr only.
impl Distribution<UnitInterval> for Open01
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f32>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f32>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl Distribution<UnitInterval> for OpenClosed01
Available on crate feature rand_distr only.
impl Distribution<UnitInterval> for OpenClosed01
rand_distr only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f32>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> UnitInterval<f32>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl Div<SignedUnitInterval<f64>> for UnitInterval<f64>
impl Div<SignedUnitInterval<f64>> for UnitInterval<f64>
Source§impl Div<SignedUnitInterval> for UnitInterval<f32>
impl Div<SignedUnitInterval> for UnitInterval<f32>
Source§impl Div<UnitInterval<f64>> for SignedUnitInterval<f64>
impl Div<UnitInterval<f64>> for SignedUnitInterval<f64>
Source§impl Div<UnitInterval> for SignedUnitInterval<f32>
impl Div<UnitInterval> for SignedUnitInterval<f32>
Source§impl Div<UnitInterval> for f32
impl Div<UnitInterval> for f32
Source§impl Div for UnitInterval<f32>
impl Div for UnitInterval<f32>
Source§impl Div for UnitInterval<f64>
impl Div for UnitInterval<f64>
Source§impl<T: UnitIntervalFloat> From<UnitInterval<T>> for SignedUnitInterval<T>
impl<T: UnitIntervalFloat> From<UnitInterval<T>> for SignedUnitInterval<T>
Source§fn from(u: UnitInterval<T>) -> Self
fn from(u: UnitInterval<T>) -> Self
Source§impl From<UnitInterval<f64>> for UnitInterval<f32>
Converts a UnitInterval<f64> into UnitInterval<f32>.
impl From<UnitInterval<f64>> for UnitInterval<f32>
Converts a UnitInterval<f64> into UnitInterval<f32>.
Source§fn from(u: UnitInterval<f64>) -> Self
fn from(u: UnitInterval<f64>) -> Self
Source§impl From<UnitInterval<f64>> for f64
impl From<UnitInterval<f64>> for f64
Source§fn from(u: UnitInterval<f64>) -> Self
fn from(u: UnitInterval<f64>) -> Self
Source§impl From<UnitInterval> for UnitInterval<f64>
Converts a UnitInterval<f32> into UnitInterval<f64>.
impl From<UnitInterval> for UnitInterval<f64>
Converts a UnitInterval<f32> into UnitInterval<f64>.
Source§fn from(u: UnitInterval<f32>) -> Self
fn from(u: UnitInterval<f32>) -> Self
Source§impl From<UnitInterval> for f32
impl From<UnitInterval> for f32
Source§fn from(u: UnitInterval<f32>) -> Self
fn from(u: UnitInterval<f32>) -> Self
Source§impl From<UnitInterval> for f64
Converts a UnitInterval<f32> into its inner value widened to f64.
impl From<UnitInterval> for f64
Converts a UnitInterval<f32> into its inner value widened to f64.
Source§fn from(u: UnitInterval) -> Self
fn from(u: UnitInterval) -> Self
Source§impl FromPrimitive for UnitInterval<f32>
Available on crate feature num-traits only.
impl FromPrimitive for UnitInterval<f32>
num-traits only.Source§fn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
i64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
u64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_f32(n: f32) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
f32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_f64(n: f64) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>
f64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
isize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
i8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
i16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
i32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
i128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
usize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
u8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
u16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§impl FromPrimitive for UnitInterval<f64>
Available on crate feature num-traits only.
impl FromPrimitive for UnitInterval<f64>
num-traits only.Source§fn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
i64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
u64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_f32(n: f32) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
f32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_f64(n: f64) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>
f64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
isize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
i8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
i16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
i32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
i128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
usize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
u8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
u16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§impl<T: UnitIntervalFloat> Mul<SignedUnitInterval<T>> for UnitInterval<T>
Multiplies a unit interval by a signed unit interval.
impl<T: UnitIntervalFloat> Mul<SignedUnitInterval<T>> for UnitInterval<T>
Multiplies a unit interval by a signed unit interval.
Source§type Output = SignedUnitInterval<T>
type Output = SignedUnitInterval<T>
* operator.Source§impl<T: UnitIntervalFloat> Mul<UnitInterval<T>> for SignedUnitInterval<T>
Multiplies a signed unit interval by a unit interval.
impl<T: UnitIntervalFloat> Mul<UnitInterval<T>> for SignedUnitInterval<T>
Multiplies a signed unit interval by a unit interval.
Source§type Output = SignedUnitInterval<T>
type Output = SignedUnitInterval<T>
* operator.Source§impl Mul<UnitInterval> for f32
impl Mul<UnitInterval> for f32
Source§impl<T: UnitIntervalFloat> Mul for UnitInterval<T>
Multiplies two unit interval values.
impl<T: UnitIntervalFloat> Mul for UnitInterval<T>
Multiplies two unit interval values.
Multiplication is implemented as an operator because the product of two
values in [0, 1] is also in [0, 1].
§Examples
use unit_intervals::UnitInterval;
let a = UnitInterval::new(0.25).unwrap();
let b = UnitInterval::new(0.75).unwrap();
assert_eq!((a * b).get(), 0.1875);Source§impl Neg for UnitInterval<f32>
impl Neg for UnitInterval<f32>
Source§impl Neg for UnitInterval<f64>
impl Neg for UnitInterval<f64>
Source§impl NumCast for UnitInterval<f32>
Available on crate feature num-traits only.
impl NumCast for UnitInterval<f32>
num-traits only.Source§impl NumCast for UnitInterval<f64>
Available on crate feature num-traits only.
impl NumCast for UnitInterval<f64>
num-traits only.Source§impl One for UnitInterval<f32>
Available on crate feature num-traits only.
impl One for UnitInterval<f32>
num-traits only.Source§impl One for UnitInterval<f64>
Available on crate feature num-traits only.
impl One for UnitInterval<f64>
num-traits only.Source§impl PartialEq<UnitInterval> for f32
impl PartialEq<UnitInterval> for f32
Source§impl<T: PartialEq> PartialEq for UnitInterval<T>
impl<T: PartialEq> PartialEq for UnitInterval<T>
Source§impl PartialOrd<UnitInterval<f64>> for f64
impl PartialOrd<UnitInterval<f64>> for f64
Source§impl PartialOrd<UnitInterval> for f32
impl PartialOrd<UnitInterval> for f32
Source§impl PartialOrd<f32> for UnitInterval<f32>
impl PartialOrd<f32> for UnitInterval<f32>
Source§impl PartialOrd<f64> for UnitInterval<f64>
impl PartialOrd<f64> for UnitInterval<f64>
Source§impl<T: PartialOrd> PartialOrd for UnitInterval<T>
impl<T: PartialOrd> PartialOrd for UnitInterval<T>
Source§impl<T: UnitIntervalFloat> Pow<&u16> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&u16> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<&u16> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&u16> for UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<&u32> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&u32> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<&u32> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&u32> for UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<&u8> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&u8> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<&u8> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&u8> for UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<&usize> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&usize> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<&usize> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<&usize> for UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<u16> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<u16> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<u16> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<u16> for UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<u32> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<u32> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<u32> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<u32> for UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<u8> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<u8> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<u8> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<u8> for UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<usize> for &UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<usize> for &UnitInterval<T>
num-traits only.Source§impl<T: UnitIntervalFloat> Pow<usize> for UnitInterval<T>
Available on crate feature num-traits only.
impl<T: UnitIntervalFloat> Pow<usize> for UnitInterval<T>
num-traits only.Source§impl Rem<SignedUnitInterval<f64>> for UnitInterval<f64>
impl Rem<SignedUnitInterval<f64>> for UnitInterval<f64>
Source§impl Rem<SignedUnitInterval> for UnitInterval<f32>
impl Rem<SignedUnitInterval> for UnitInterval<f32>
Source§impl Rem<UnitInterval<f64>> for SignedUnitInterval<f64>
impl Rem<UnitInterval<f64>> for SignedUnitInterval<f64>
Source§impl Rem<UnitInterval> for SignedUnitInterval<f32>
impl Rem<UnitInterval> for SignedUnitInterval<f32>
Source§impl Rem<UnitInterval> for f32
impl Rem<UnitInterval> for f32
Source§impl Rem for UnitInterval<f32>
impl Rem for UnitInterval<f32>
Source§impl Rem for UnitInterval<f64>
impl Rem for UnitInterval<f64>
Source§impl SaturatingMul for UnitInterval<f32>
Available on crate feature num-traits only.
impl SaturatingMul for UnitInterval<f32>
num-traits only.Source§fn saturating_mul(&self, v: &Self) -> Self
fn saturating_mul(&self, v: &Self) -> Self
self * other, saturating at the relevant high or low boundary of
the type.Source§impl SaturatingMul for UnitInterval<f64>
Available on crate feature num-traits only.
impl SaturatingMul for UnitInterval<f64>
num-traits only.Source§fn saturating_mul(&self, v: &Self) -> Self
fn saturating_mul(&self, v: &Self) -> Self
self * other, saturating at the relevant high or low boundary of
the type.Source§impl<T: Serialize> Serialize for UnitInterval<T>
Available on crate feature serde only.
impl<T: Serialize> Serialize for UnitInterval<T>
serde only.Source§impl Sub<SignedUnitInterval<f64>> for UnitInterval<f64>
impl Sub<SignedUnitInterval<f64>> for UnitInterval<f64>
Source§impl Sub<SignedUnitInterval> for UnitInterval<f32>
impl Sub<SignedUnitInterval> for UnitInterval<f32>
Source§impl Sub<UnitInterval<f64>> for SignedUnitInterval<f64>
impl Sub<UnitInterval<f64>> for SignedUnitInterval<f64>
Source§impl Sub<UnitInterval> for SignedUnitInterval<f32>
impl Sub<UnitInterval> for SignedUnitInterval<f32>
Source§impl Sub<UnitInterval> for f32
impl Sub<UnitInterval> for f32
Source§impl Sub for UnitInterval<f32>
impl Sub for UnitInterval<f32>
Source§impl Sub for UnitInterval<f64>
impl Sub for UnitInterval<f64>
Source§impl ToBytes for UnitInterval<f32>
Available on crate feature num-traits only.
impl ToBytes for UnitInterval<f32>
num-traits only.type Bytes = <f32 as ToBytes>::Bytes
Source§fn to_be_bytes(&self) -> Self::Bytes
fn to_be_bytes(&self) -> Self::Bytes
Source§fn to_le_bytes(&self) -> Self::Bytes
fn to_le_bytes(&self) -> Self::Bytes
Source§fn to_ne_bytes(&self) -> Self::Bytes
fn to_ne_bytes(&self) -> Self::Bytes
Source§impl ToBytes for UnitInterval<f64>
Available on crate feature num-traits only.
impl ToBytes for UnitInterval<f64>
num-traits only.type Bytes = <f64 as ToBytes>::Bytes
Source§fn to_be_bytes(&self) -> Self::Bytes
fn to_be_bytes(&self) -> Self::Bytes
Source§fn to_le_bytes(&self) -> Self::Bytes
fn to_le_bytes(&self) -> Self::Bytes
Source§fn to_ne_bytes(&self) -> Self::Bytes
fn to_ne_bytes(&self) -> Self::Bytes
Source§impl ToPrimitive for UnitInterval<f32>
Available on crate feature num-traits only.
impl ToPrimitive for UnitInterval<f32>
num-traits only.Source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
self to an isize. If the value cannot be
represented by an isize, then None is returned.Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
self to an i8. If the value cannot be
represented by an i8, then None is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
self to an i16. If the value cannot be
represented by an i16, then None is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
self to an i32. If the value cannot be
represented by an i32, then None is returned.Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
self to an i64. If the value cannot be
represented by an i64, then None is returned.Source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
self to an i128. If the value cannot be
represented by an i128 (i64 under the default implementation), then
None is returned. Read moreSource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
self to a usize. If the value cannot be
represented by a usize, then None is returned.Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
self to a u8. If the value cannot be
represented by a u8, then None is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
self to a u16. If the value cannot be
represented by a u16, then None is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
self to a u32. If the value cannot be
represented by a u32, then None is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
self to a u64. If the value cannot be
represented by a u64, then None is returned.Source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
self to a u128. If the value cannot be
represented by a u128 (u64 under the default implementation), then
None is returned. Read moreSource§impl ToPrimitive for UnitInterval<f64>
Available on crate feature num-traits only.
impl ToPrimitive for UnitInterval<f64>
num-traits only.Source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
self to an isize. If the value cannot be
represented by an isize, then None is returned.Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
self to an i8. If the value cannot be
represented by an i8, then None is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
self to an i16. If the value cannot be
represented by an i16, then None is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
self to an i32. If the value cannot be
represented by an i32, then None is returned.Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
self to an i64. If the value cannot be
represented by an i64, then None is returned.Source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
self to an i128. If the value cannot be
represented by an i128 (i64 under the default implementation), then
None is returned. Read moreSource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
self to a usize. If the value cannot be
represented by a usize, then None is returned.Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
self to a u8. If the value cannot be
represented by a u8, then None is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
self to a u16. If the value cannot be
represented by a u16, then None is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
self to a u32. If the value cannot be
represented by a u32, then None is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
self to a u64. If the value cannot be
represented by a u64, then None is returned.Source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
self to a u128. If the value cannot be
represented by a u128 (u64 under the default implementation), then
None is returned. Read moreSource§impl<T: UnitIntervalFloat> TryFrom<SignedUnitInterval<T>> for UnitInterval<T>
impl<T: UnitIntervalFloat> TryFrom<SignedUnitInterval<T>> for UnitInterval<T>
Source§type Error = UnitIntervalError
type Error = UnitIntervalError
Source§impl<T> Zeroable for UnitInterval<T>where
T: UnitIntervalFloat + Zeroable,
Available on crate feature bytemuck only.
impl<T> Zeroable for UnitInterval<T>where
T: UnitIntervalFloat + Zeroable,
bytemuck only.impl<T: Copy> Copy for UnitInterval<T>
impl<T> NoUninit for UnitInterval<T>where
T: UnitIntervalFloat + NoUninit,
bytemuck only.impl<T> StructuralPartialEq for UnitInterval<T>
Auto Trait Implementations§
impl<T> Freeze for UnitInterval<T>where
T: Freeze,
impl<T> RefUnwindSafe for UnitInterval<T>where
T: RefUnwindSafe,
impl<T> Send for UnitInterval<T>where
T: Send,
impl<T> Sync for UnitInterval<T>where
T: Sync,
impl<T> Unpin for UnitInterval<T>where
T: Unpin,
impl<T> UnsafeUnpin for UnitInterval<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for UnitInterval<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> LowerBounded for Twhere
T: Bounded,
impl<T> LowerBounded for Twhere
T: Bounded,
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.