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