pub struct NonAnyU128<const NICHE: u128>(/* private fields */);Expand description
An integer that is known not to equal NICHE.
This enables some memory layout optimization.
For example, Option<NonAnyU128<0>> is the same size as u128:
assert_eq!(core::mem::size_of::<Option<nonany::NonAnyU128<0>>>(), core::mem::size_of::<u128>());Implementations§
Source§impl<const NICHE: u128> NonAnyU128<NICHE>
impl<const NICHE: u128> NonAnyU128<NICHE>
Sourcepub const fn new(value: u128) -> Option<Self>
pub const fn new(value: u128) -> Option<Self>
Creates a non-any if the given value is not NICHE.
Sourcepub const unsafe fn new_unchecked(value: u128) -> Self
pub const unsafe fn new_unchecked(value: u128) -> 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: u128> Binary for NonAnyU128<NICHE>
impl<const NICHE: u128> Binary for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> Clone for NonAnyU128<NICHE>
impl<const NICHE: u128> Clone for NonAnyU128<NICHE>
Source§fn clone(&self) -> NonAnyU128<NICHE>
fn clone(&self) -> NonAnyU128<NICHE>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const NICHE: u128> Debug for NonAnyU128<NICHE>
impl<const NICHE: u128> Debug for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> Display for NonAnyU128<NICHE>
impl<const NICHE: u128> Display for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> Hash for NonAnyU128<NICHE>
impl<const NICHE: u128> Hash for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> LowerExp for NonAnyU128<NICHE>
impl<const NICHE: u128> LowerExp for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> LowerHex for NonAnyU128<NICHE>
impl<const NICHE: u128> LowerHex for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> Octal for NonAnyU128<NICHE>
impl<const NICHE: u128> Octal for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> Ord for NonAnyU128<NICHE>
impl<const NICHE: u128> Ord for NonAnyU128<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: u128> PartialEq for NonAnyU128<NICHE>
impl<const NICHE: u128> PartialEq for NonAnyU128<NICHE>
Source§fn eq(&self, other: &NonAnyU128<NICHE>) -> bool
fn eq(&self, other: &NonAnyU128<NICHE>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<const NICHE: u128> PartialOrd for NonAnyU128<NICHE>
impl<const NICHE: u128> PartialOrd for NonAnyU128<NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: i128> TryFrom<NonAnyI128<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: i128> TryFrom<NonAnyI128<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: u128, const FROM_NICHE: i16> TryFrom<NonAnyI16<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: i16> TryFrom<NonAnyI16<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: i32> TryFrom<NonAnyI32<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: i32> TryFrom<NonAnyI32<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: i64> TryFrom<NonAnyI64<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: i64> TryFrom<NonAnyI64<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: i8> TryFrom<NonAnyI8<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: i8> TryFrom<NonAnyI8<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: isize> TryFrom<NonAnyIsize<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: isize> TryFrom<NonAnyIsize<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: i128, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI128<TO_NICHE>
impl<const TO_NICHE: i128, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI128<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: i16, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI16<TO_NICHE>
impl<const TO_NICHE: i16, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI16<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: i32, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI32<TO_NICHE>
impl<const TO_NICHE: i32, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI32<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: i64, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI64<TO_NICHE>
impl<const TO_NICHE: i64, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI64<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: i8, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI8<TO_NICHE>
impl<const TO_NICHE: i8, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyI8<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: isize, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyIsize<TO_NICHE>
impl<const TO_NICHE: isize, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyIsize<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: u16, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU16<TO_NICHE>
impl<const TO_NICHE: u16, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU16<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: u64, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU64<TO_NICHE>
impl<const TO_NICHE: u64, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU64<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: u8, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU8<TO_NICHE>
impl<const TO_NICHE: u8, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyU8<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: usize, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyUsize<TO_NICHE>
impl<const TO_NICHE: usize, const FROM_NICHE: u128> TryFrom<NonAnyU128<FROM_NICHE>> for NonAnyUsize<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const TO_NICHE: u128, const FROM_NICHE: u16> TryFrom<NonAnyU16<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: u16> TryFrom<NonAnyU16<FROM_NICHE>> for NonAnyU128<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: u128, const FROM_NICHE: u64> TryFrom<NonAnyU64<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: u64> TryFrom<NonAnyU64<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: u8> TryFrom<NonAnyU8<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: u8> TryFrom<NonAnyU8<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§impl<const TO_NICHE: u128, const FROM_NICHE: usize> TryFrom<NonAnyUsize<FROM_NICHE>> for NonAnyU128<TO_NICHE>
impl<const TO_NICHE: u128, const FROM_NICHE: usize> TryFrom<NonAnyUsize<FROM_NICHE>> for NonAnyU128<TO_NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<i128>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<i128>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<i16>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<i16>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<i32>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<i32>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<i64>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<i64>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<isize>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<isize>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<u128>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<u128>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<u16>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<u16>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<u32>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<u32>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<u64>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<u64>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> TryFrom<NonZero<usize>> for NonAnyU128<NICHE>
impl<const NICHE: u128> TryFrom<NonZero<usize>> for NonAnyU128<NICHE>
Source§type Error = CheckedError
type Error = CheckedError
The type returned in the event of a conversion error.
Source§impl<const NICHE: u128> UpperExp for NonAnyU128<NICHE>
impl<const NICHE: u128> UpperExp for NonAnyU128<NICHE>
Source§impl<const NICHE: u128> UpperHex for NonAnyU128<NICHE>
impl<const NICHE: u128> UpperHex for NonAnyU128<NICHE>
impl<const NICHE: u128> Copy for NonAnyU128<NICHE>
impl<const NICHE: u128> Eq for NonAnyU128<NICHE>
impl<const NICHE: u128> StructuralPartialEq for NonAnyU128<NICHE>
Auto Trait Implementations§
impl<const NICHE: u128> Freeze for NonAnyU128<NICHE>
impl<const NICHE: u128> RefUnwindSafe for NonAnyU128<NICHE>
impl<const NICHE: u128> Send for NonAnyU128<NICHE>
impl<const NICHE: u128> Sync for NonAnyU128<NICHE>
impl<const NICHE: u128> Unpin for NonAnyU128<NICHE>
impl<const NICHE: u128> UnsafeUnpin for NonAnyU128<NICHE>
impl<const NICHE: u128> UnwindSafe for NonAnyU128<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