pub struct BoundedU8<const MIN: u8, const MAX: u8>(pub u8);Expand description
A bounded u8
Tuple Fields§
§0: u8Implementations§
Source§impl<const MIN: u8, const MAX: u8> BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> BoundedU8<MIN, MAX>
Sourcepub const fn new(v: u8) -> Result<Self, Error>
pub const fn new(v: u8) -> Result<Self, Error>
Create a new bounded int with the given value in it, if it’s within bounds
Sourcepub const fn new_unwrap(v: u8) -> Self
pub const fn new_unwrap(v: u8) -> Self
Create a new bounded int with the given value in it; panics if the value is not within bounds
Sourcepub const fn new_static<const V: u8>() -> Self
pub const fn new_static<const V: u8>() -> Self
Create a new bounded int at compile time.
Checks arguments at compile time - for instance, the following doesn’t compile:
const Bounded : sqrid::U8Bounded<0,5> = sqrid::U8Bounded::<0,5>::new_static::<9>();Sourcepub const fn into_inner(self) -> u8
pub const fn into_inner(self) -> u8
Deconstructs an $name and returns the the inner value
Trait Implementations§
Source§impl<const MIN: u8, const MAX: u8> BoundedInt for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> BoundedInt for BoundedU8<MIN, MAX>
Source§fn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Extract the inner value.
Source§fn checked_add(self, other: Self) -> Option<Self>
fn checked_add(self, other: Self) -> Option<Self>
Checked integer addition.
Source§fn checked_sub(self, other: Self) -> Option<Self>
fn checked_sub(self, other: Self) -> Option<Self>
Checked integer subtraction.
Source§fn iter() -> BoundedIntIterator<Self> ⓘ
fn iter() -> BoundedIntIterator<Self> ⓘ
Return an iterator for all values of this
BoundedInt type.Source§impl<const MIN: u8, const MAX: u8> Ord for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Ord for BoundedU8<MIN, MAX>
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: u8, const MAX: u8> PartialOrd for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> PartialOrd for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Copy for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Eq for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> StructuralPartialEq for BoundedU8<MIN, MAX>
Auto Trait Implementations§
impl<const MIN: u8, const MAX: u8> Freeze for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> RefUnwindSafe for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Send for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Sync for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Unpin for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> UnwindSafe for BoundedU8<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