pub struct NonAnyU32<const NICHE: u32>(/* private fields */);Expand description
An integer that is known not to equal NICHE.
This enables some memory layout optimization.
For example, Option<NonAnyU32<0>> is the same size as u32:
assert_eq!(core::mem::size_of::<Option<nonany::NonAnyU32<0>>>(), core::mem::size_of::<u32>());Implementations§
Source§impl<const NICHE: u32> NonAnyU32<NICHE>
impl<const NICHE: u32> NonAnyU32<NICHE>
Sourcepub const fn new(value: u32) -> Option<Self>
pub const fn new(value: u32) -> Option<Self>
Creates a non-any if the given value is not NICHE.
Sourcepub const unsafe fn new_unchecked(value: u32) -> Self
pub const unsafe fn new_unchecked(value: u32) -> Self
Creates a non-any without checking whether the value is NICHE.
This results in undefined behaviour if the value is NICHE.
§Safety
The value must not be NICHE.
Trait Implementations§
Source§impl<const NICHE: u32> Ord for NonAnyU32<NICHE>
impl<const NICHE: u32> Ord for NonAnyU32<NICHE>
1.21.0 (const: unstable) · 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 NICHE: u32> PartialEq for NonAnyU32<NICHE>
impl<const NICHE: u32> PartialEq for NonAnyU32<NICHE>
Source§impl<const NICHE: u32> PartialOrd for NonAnyU32<NICHE>
impl<const NICHE: u32> PartialOrd for NonAnyU32<NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: i128> TryFrom<NonAnyI128<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: i128> TryFrom<NonAnyI128<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: u32, const FROM_NICHE: i16> TryFrom<NonAnyI16<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: i16> TryFrom<NonAnyI16<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: i32> TryFrom<NonAnyI32<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: i32> TryFrom<NonAnyI32<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: i64> TryFrom<NonAnyI64<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: i64> TryFrom<NonAnyI64<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: i8> TryFrom<NonAnyI8<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: i8> TryFrom<NonAnyI8<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: isize> TryFrom<NonAnyIsize<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: isize> TryFrom<NonAnyIsize<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: u32, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: u32, const FROM_NICHE: u16> TryFrom<NonAnyU16<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: u16> TryFrom<NonAnyU16<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§impl<const TO_NICHE: i128, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI128<TO_NICHE>
impl<const TO_NICHE: i128, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI128<TO_NICHE>
Source§impl<const TO_NICHE: i16, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI16<TO_NICHE>
impl<const TO_NICHE: i16, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI16<TO_NICHE>
Source§impl<const TO_NICHE: i32, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI32<TO_NICHE>
impl<const TO_NICHE: i32, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI32<TO_NICHE>
Source§impl<const TO_NICHE: i64, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI64<TO_NICHE>
impl<const TO_NICHE: i64, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI64<TO_NICHE>
Source§impl<const TO_NICHE: i8, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI8<TO_NICHE>
impl<const TO_NICHE: i8, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyI8<TO_NICHE>
Source§impl<const TO_NICHE: isize, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyIsize<TO_NICHE>
impl<const TO_NICHE: isize, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyIsize<TO_NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§impl<const TO_NICHE: u16, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU16<TO_NICHE>
impl<const TO_NICHE: u16, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU16<TO_NICHE>
Source§impl<const TO_NICHE: u64, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU64<TO_NICHE>
impl<const TO_NICHE: u64, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU64<TO_NICHE>
Source§impl<const TO_NICHE: u8, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU8<TO_NICHE>
impl<const TO_NICHE: u8, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyU8<TO_NICHE>
Source§impl<const TO_NICHE: usize, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyUsize<TO_NICHE>
impl<const TO_NICHE: usize, const FROM_NICHE: u32> TryFrom<NonAnyU32<FROM_NICHE>> for NonAnyUsize<TO_NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: u64> TryFrom<NonAnyU64<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: u64> TryFrom<NonAnyU64<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: u8> TryFrom<NonAnyU8<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: u8> TryFrom<NonAnyU8<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§impl<const TO_NICHE: u32, const FROM_NICHE: usize> TryFrom<NonAnyUsize<FROM_NICHE>> for NonAnyU32<TO_NICHE>
impl<const TO_NICHE: u32, const FROM_NICHE: usize> TryFrom<NonAnyUsize<FROM_NICHE>> for NonAnyU32<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<i128>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<i128>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<i16>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<i16>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<i32>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<i32>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<i64>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<i64>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<isize>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<isize>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<u128>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<u128>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<u16>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<u16>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<u32>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<u32>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<u64>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<u64>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u32> TryFrom<NonZero<usize>> for NonAnyU32<NICHE>
impl<const NICHE: u32> TryFrom<NonZero<usize>> for NonAnyU32<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
impl<const NICHE: u32> Copy for NonAnyU32<NICHE>
impl<const NICHE: u32> Eq for NonAnyU32<NICHE>
impl<const NICHE: u32> StructuralPartialEq for NonAnyU32<NICHE>
Auto Trait Implementations§
impl<const NICHE: u32> Freeze for NonAnyU32<NICHE>
impl<const NICHE: u32> RefUnwindSafe for NonAnyU32<NICHE>
impl<const NICHE: u32> Send for NonAnyU32<NICHE>
impl<const NICHE: u32> Sync for NonAnyU32<NICHE>
impl<const NICHE: u32> Unpin for NonAnyU32<NICHE>
impl<const NICHE: u32> UnsafeUnpin for NonAnyU32<NICHE>
impl<const NICHE: u32> UnwindSafe for NonAnyU32<NICHE>
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