#[repr(transparent)]pub struct Ointer<T, const A: u8, const S: bool, const V: u8> { /* private fields */ }
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.
Implementations§
source§impl<T, const A: u8, const S: bool, const V: u8> Ointer<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> Ointer<T, A, S, V>
sourcepub unsafe fn new(ptr: *mut T) -> Self
pub unsafe fn new(ptr: *mut T) -> Self
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.
sourcepub unsafe fn new_stealing(ptr: *mut T, bits: usize) -> Self
pub unsafe fn new_stealing(ptr: *mut T, bits: usize) -> Self
Trait Implementations§
source§impl<T, const A: u8, const S: bool, const V: u8> PartialEq<Ointer<T, A, S, V>> for Ointer<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> PartialEq<Ointer<T, A, S, V>> for Ointer<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> Copy for Ointer<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> Eq for Ointer<T, A, S, V>
Auto Trait Implementations§
impl<T, const A: u8, const S: bool, const V: u8> RefUnwindSafe for Ointer<T, A, S, V>where T: RefUnwindSafe,
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, const A: u8, const S: bool, const V: u8> UnwindSafe for Ointer<T, A, S, V>where T: RefUnwindSafe,
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