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