pub struct BoundedU8<const MIN: u8, const MAX: u8>(/* private fields */);Expand description
Wrapper type for a u8, providing minimum and maximum value bounds.
Implementations§
Trait Implementations§
source§impl<const MIN: u8, const MAX: u8> Default for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Default for BoundedU8<MIN, MAX>
This implementation returns the closest bounded integer to zero.
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> Packable for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> Packable for BoundedU8<MIN, MAX>
§type UnpackError = InvalidBoundedU8<MIN, MAX>
type UnpackError = InvalidBoundedU8<MIN, MAX>
The error type that can be returned if some semantic error occurs while unpacking. Read more
§type UnpackVisitor = <u8 as Packable>::UnpackVisitor
type UnpackVisitor = <u8 as Packable>::UnpackVisitor
FIXME: docs
source§fn pack<P: Packer>(&self, packer: &mut P) -> Result<(), P::Error>
fn pack<P: Packer>(&self, packer: &mut P) -> Result<(), P::Error>
Packs this value into the given
Packer.source§fn unpack<U: Unpacker, const VERIFY: bool>(
unpacker: &mut U,
visitor: &Self::UnpackVisitor
) -> Result<Self, UnpackError<Self::UnpackError, U::Error>>
fn unpack<U: Unpacker, const VERIFY: bool>( unpacker: &mut U, visitor: &Self::UnpackVisitor ) -> Result<Self, UnpackError<Self::UnpackError, U::Error>>
Unpacks this value from the given
Unpacker. The VERIFY generic parameter can be used to skip additional
syntactic checks.source§impl<const MIN: u8, const MAX: u8> PartialEq for BoundedU8<MIN, MAX>
impl<const MIN: u8, const MAX: u8> PartialEq for BoundedU8<MIN, MAX>
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>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<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> StructuralEq 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> 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
source§impl<P> PackableExt for Pwhere
P: Packable,
impl<P> PackableExt for Pwhere P: Packable,
source§fn unpack_verified<T>(
bytes: T,
visitor: &<P as Packable>::UnpackVisitor
) -> Result<P, UnpackError<<P as Packable>::UnpackError, UnexpectedEOF>>where
T: AsRef<[u8]>,
fn unpack_verified<T>( bytes: T, visitor: &<P as Packable>::UnpackVisitor ) -> Result<P, UnpackError<<P as Packable>::UnpackError, UnexpectedEOF>>where T: AsRef<[u8]>,
Unpacks this value from a type that implements [AsRef<[u8]>].
source§fn unpack_unverified<T>(
bytes: T
) -> Result<P, UnpackError<<P as Packable>::UnpackError, UnexpectedEOF>>where
T: AsRef<[u8]>,
fn unpack_unverified<T>( bytes: T ) -> Result<P, UnpackError<<P as Packable>::UnpackError, UnexpectedEOF>>where T: AsRef<[u8]>,
Unpacks this value from a type that implements [AsRef<[u8]>] skipping some syntatical checks.
source§fn packed_len(&self) -> usize
fn packed_len(&self) -> usize
Returns the length in bytes of the value after being packed. The returned value always matches the number of
bytes written using
pack.