#[repr(transparent)]
pub struct Ointer<T, const A: u8, const S: bool, const V: u8> { /* fields omitted */ }
Expand description
A pointer we stole the high bits off
T: type pointed to.
A: number of bits to steal based on the alignment requirements of T.
S: whether to steal the sign bit.
V: number of bits to steal from unused virtual address space.
impl<T: Sized, const A: u8, const S: bool, const V: u8> Ointer<T, A, S, V>
pub unsafe fn new(ptr: *mut T) -> Self
Creates a new Ointer from a presumed legitimate pointer.
- 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.
pub fn steal(self, bits: usize) -> Self
Takes a value from the high bits of the provided usize and
steals them from the ointer.
Get the pointer without the stolen bits
pub fn raw(self) -> *mut T
Direct access to the underlying data. The pointer it returns
may not be valid.
impl<T: Sized, const A: u8, const S: bool, const V: u8> Clone for Ointer<T, A, S, V>
Performs copy-assignment from source
. Read more
impl<T: Debug, const A: u8, const S: bool, const V: u8> Debug for Ointer<T, A, S, V>
Formats the value using the given formatter. Read more
impl<T: Hash, const A: u8, const S: bool, const V: u8> Hash for Ointer<T, A, S, V>
fn eq(&self, other: &Ointer<T, A, S, V>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Ointer<T, A, S, V>) -> bool
This method tests for !=
.
impl<T: Sized, const A: u8, const S: bool, const V: u8> Copy for Ointer<T, A, S, V>
impl<T: Eq, const A: u8, const S: bool, const V: u8> Eq for Ointer<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> !Send for Ointer<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> !Sync for Ointer<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> Unpin for Ointer<T, A, S, V>
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.