pub struct NonXIsize<const FORBIDDEN: isize> { /* private fields */ }Expand description
A number whose value is guaranteed not to be FORBIDDEN.
x is stored as NonZero(x.wrapping_sub(FORBIDDEN)), so transmuting results in wrong values.
Implementations§
Source§impl<const FORBIDDEN: isize> NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> NonXIsize<FORBIDDEN>
Sourcepub const fn new(n: isize) -> Option<Self>
pub const fn new(n: isize) -> Option<Self>
Construct Self, returning None if n is the FORBIDDEN value.
Sourcepub const unsafe fn new_unchecked(n: isize) -> Self
pub const unsafe fn new_unchecked(n: isize) -> Self
Constructs Self without checking whether or not it is only 1s.
§Safety
Calling this with the illegal value may result in undefined behaviour.
Trait Implementations§
Source§impl<const FORBIDDEN: isize> IStable for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> IStable for NonXIsize<FORBIDDEN>
Source§const ID: u64 = 11_460_796_473_375_481_083u64
const ID: u64 = 11_460_796_473_375_481_083u64
A stable (and ideally unique) identifier for the type. Often generated using
crate::report::gen_id, but can be manually set.Source§const REPORT: &'static TypeReport
const REPORT: &'static TypeReport
A compile-time generated report of the fields of the type, allowing for compatibility inspection.
Source§type ForbiddenValues = <NonZero<isize> as IStable>::ForbiddenValues
type ForbiddenValues = <NonZero<isize> as IStable>::ForbiddenValues
The values that the annotated type cannot occupy.
Source§type UnusedBits = <NonZero<isize> as IStable>::UnusedBits
type UnusedBits = <NonZero<isize> as IStable>::UnusedBits
The padding bits in the annotated types
Source§type HasExactlyOneNiche = <NonZero<isize> as IStable>::HasExactlyOneNiche
type HasExactlyOneNiche = <NonZero<isize> as IStable>::HasExactlyOneNiche
Allows the detection of whether or not
core::option::Options are stable: Read moreSource§type ContainsIndirections = <NonZero<isize> as IStable>::ContainsIndirections
type ContainsIndirections = <NonZero<isize> as IStable>::ContainsIndirections
Whether or not the type contains indirections (pointers, indices in independent data-structures…)
Source§impl<const FORBIDDEN: isize> Ord for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> Ord for NonXIsize<FORBIDDEN>
Source§impl<const FORBIDDEN: isize> PartialOrd for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> PartialOrd for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> Copy for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> Eq for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> StructuralPartialEq for NonXIsize<FORBIDDEN>
Auto Trait Implementations§
impl<const FORBIDDEN: isize> Freeze for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> RefUnwindSafe for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> Send for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> Sync for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> Unpin for NonXIsize<FORBIDDEN>
impl<const FORBIDDEN: isize> UnwindSafe for NonXIsize<FORBIDDEN>
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IPod for T
impl<T> IPod for T
Source§fn identifier() -> u64
fn identifier() -> u64
Produces an identifier for the type, allowing to check type at runtime (barring collisions).