pub struct NonNegative<T>(pub T);Expand description
A non-negative value wrapper.
This wrapper validates that literal values are >= 0 at parse time.
Tuple Fields§
§0: TImplementations§
Source§impl<T> NonNegative<T>
impl<T> NonNegative<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes self and returns the inner value.
Trait Implementations§
Source§impl<T: Clone> Clone for NonNegative<T>
impl<T: Clone> 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: Debug> Debug for NonNegative<T>
impl<T: Debug> Debug for NonNegative<T>
Source§impl<T: Into<Cursor>> From<NonNegative<T>> for Cursor
impl<T: Into<Cursor>> From<NonNegative<T>> for Cursor
Source§fn from(value: NonNegative<T>) -> Self
fn from(value: NonNegative<T>) -> Self
Converts to this type from the input type.
Source§impl<T: Hash> Hash for NonNegative<T>
impl<T: Hash> Hash for NonNegative<T>
Source§impl<T: Ord> Ord for NonNegative<T>
impl<T: Ord> Ord for NonNegative<T>
Source§fn cmp(&self, other: &NonNegative<T>) -> Ordering
fn cmp(&self, other: &NonNegative<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a, T: Parse<'a> + ToNumberValue> Parse<'a> for NonNegative<T>
impl<'a, T: Parse<'a> + ToNumberValue> Parse<'a> for NonNegative<T>
Source§impl<T: PartialEq> PartialEq for NonNegative<T>
impl<T: PartialEq> PartialEq for NonNegative<T>
Source§impl<T: PartialOrd> PartialOrd for NonNegative<T>
impl<T: PartialOrd> PartialOrd for NonNegative<T>
Source§impl<'a, T: Peek<'a>> Peek<'a> for NonNegative<T>
impl<'a, T: Peek<'a>> Peek<'a> for NonNegative<T>
Source§impl<T: SemanticEq> SemanticEq for NonNegative<T>
impl<T: SemanticEq> SemanticEq for NonNegative<T>
Source§fn semantic_eq(&self, other: &Self) -> bool
fn semantic_eq(&self, other: &Self) -> bool
Returns
true if self and other are semantically equal.Source§impl<T> ToCursors for NonNegative<T>where
T: ToCursors,
impl<T> ToCursors for NonNegative<T>where
T: ToCursors,
fn to_cursors(&self, s: &mut impl CursorSink)
impl<T: Copy> Copy for NonNegative<T>
impl<T: Eq> Eq for NonNegative<T>
impl<T> 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> UnsafeUnpin for NonNegative<T>where
T: UnsafeUnpin,
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