pub struct Closed01<F>(/* private fields */)
where
F: Copy + Clone + Debug + PartialEq + PartialOrd + Float + Zero + One;Expand description
Encapsulates a floating point number in the range [0, 1] including both endpoints.
Implementations§
Source§impl<F> Closed01<F>
impl<F> Closed01<F>
pub fn new(f: F) -> Self
pub fn zero() -> Self
pub fn center() -> Self
pub fn one() -> Self
pub fn get(self) -> F
Sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Saturating add
Sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Saturating sub
pub fn approx_eq(self, other: Self, eps: Self) -> bool
Sourcepub fn scale_down(self, other: Self) -> Self
pub fn scale_down(self, other: Self) -> Self
This scales self towards 0.0
Trait Implementations§
Source§impl<F> PartialOrd for Closed01<F>
impl<F> PartialOrd for Closed01<F>
impl<F> Copy for Closed01<F>
impl<F> StructuralPartialEq for Closed01<F>
Auto Trait Implementations§
impl<F> Freeze for Closed01<F>where
F: Freeze,
impl<F> RefUnwindSafe for Closed01<F>where
F: RefUnwindSafe,
impl<F> Send for Closed01<F>where
F: Send,
impl<F> Sync for Closed01<F>where
F: Sync,
impl<F> Unpin for Closed01<F>where
F: Unpin,
impl<F> UnwindSafe for Closed01<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more