pub struct RangedConstI32<const MIN: i32, const MAX: i32> { /* private fields */ }Implementations§
Source§impl<const MIN: i32, const MAX: i32> RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> RangedConstI32<MIN, MAX>
Sourcepub const fn new(value: i32) -> Self
pub const fn new(value: i32) -> Self
Create a new RangedConst value. Panics if the value is out of range
Sourcepub const fn check_range(value: i32) -> Option<Self>
pub const fn check_range(value: i32) -> Option<Self>
Checks the value against the range and returns None if it is out of range
Sourcepub const fn value(&self) -> i32
pub const fn value(&self) -> i32
Get the value of the RangedConst value as a primitive type assuming that it is in range
Sourcepub const fn increment(&self) -> Option<Self>
pub const fn increment(&self) -> Option<Self>
Safely increments the value and returns None if we hit the maximum value.
Trait Implementations§
Source§impl<const MIN: i32, const MAX: i32> Clone for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> Clone for RangedConstI32<MIN, MAX>
Source§fn clone(&self) -> RangedConstI32<MIN, MAX>
fn clone(&self) -> RangedConstI32<MIN, MAX>
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<const MIN: i32, const MAX: i32> Ord for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> Ord for RangedConstI32<MIN, MAX>
Source§fn cmp(&self, other: &RangedConstI32<MIN, MAX>) -> Ordering
fn cmp(&self, other: &RangedConstI32<MIN, MAX>) -> 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<const MIN: i32, const MAX: i32> PartialOrd for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> PartialOrd for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> Copy for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> Eq for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> StructuralPartialEq for RangedConstI32<MIN, MAX>
Auto Trait Implementations§
impl<const MIN: i32, const MAX: i32> Freeze for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> RefUnwindSafe for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> Send for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> Sync for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> Unpin for RangedConstI32<MIN, MAX>
impl<const MIN: i32, const MAX: i32> UnwindSafe for RangedConstI32<MIN, MAX>
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