pub struct NonNegative<T: Float>(/* private fields */);Expand description
Wrapper type guaranteeing a non-negative floating-point value.
Implementations§
Source§impl<T: Float> NonNegative<T>
impl<T: Float> NonNegative<T>
Sourcepub fn try_new(value: T) -> Result<Self, NonNegativeError>
pub fn try_new(value: T) -> Result<Self, NonNegativeError>
Attempts to create a new NonNegative<T> from a value.
Returns Err if the value is negative or not finite.
Trait Implementations§
Source§impl<T: Clone + Float> Clone for NonNegative<T>
impl<T: Clone + Float> Clone for NonNegative<T>
Source§fn clone(&self) -> NonNegative<T>
fn clone(&self) -> NonNegative<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: PartialOrd + Float> PartialOrd for NonNegative<T>
impl<T: PartialOrd + Float> PartialOrd for NonNegative<T>
impl<T: Copy + Float> Copy for NonNegative<T>
impl<T: Float> StructuralPartialEq for NonNegative<T>
Auto Trait Implementations§
impl<T> Freeze for NonNegative<T>where
T: Freeze,
impl<T> RefUnwindSafe for NonNegative<T>where
T: RefUnwindSafe,
impl<T> Send for NonNegative<T>where
T: Send,
impl<T> Sync for NonNegative<T>where
T: Sync,
impl<T> Unpin for NonNegative<T>where
T: Unpin,
impl<T> UnwindSafe for NonNegative<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more