Struct ointers::NotNull[][src]

#[repr(transparent)]
pub struct NotNull<T, const A: u8, const S: bool, const V: u8>(_);
Expand description

A non-null pointer that we stole the high bits off.

T: type pointed to. V: number of bits to steal directly by masking them off. A: number of bits to steal based on the alignment requirements of T.

Implementations

Creates a new Ointer from a presumed legitimate pointer.

Safety

  • T’s alignment must enable stealing A bits.
  • The high bits (sign upwards) must match a stack pointer’s high bits.
  • If compiling for a 64bit arch, V must be at most 25.
  • If compiling for a non-64bit arch, V must be 0.

These invariants are checked with debug_assert only, hence unsafe. The usual caveats of pointers apply.

Returns the stolen bits in the high pos.

Takes a value from the high bits of the provided usize and steals them from the ointer.

Get the pointer without the stolen bits

Direct access to the underlying data. The pointer it returns may not be valid.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.