#[repr(transparent)]pub struct Ox<T, const A: u8, const S: bool, const V: u8>(_, _);
Expand description
A Box 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§
source§impl<T, const A: u8, const S: bool, const V: u8> Ox<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> Ox<T, A, S, V>
sourcepub unsafe fn new(boxed: Box<T>) -> Self
pub unsafe fn new(boxed: Box<T>) -> Self
Creates a new Ox from a box.
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(boxed: Box<T>, bits: usize) -> Self
pub unsafe fn new_stealing(boxed: Box<T>, bits: usize) -> Self
Trait Implementations§
source§impl<T, const A: u8, const S: bool, const V: u8> PartialEq<Ox<T, A, S, V>> for Ox<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> PartialEq<Ox<T, A, S, V>> for Ox<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> Eq for Ox<T, A, S, V>
Auto Trait Implementations§
impl<T, const A: u8, const S: bool, const V: u8> RefUnwindSafe for Ox<T, A, S, V>where T: RefUnwindSafe,
impl<T, const A: u8, const S: bool, const V: u8> !Send for Ox<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> !Sync for Ox<T, A, S, V>
impl<T, const A: u8, const S: bool, const V: u8> Unpin for Ox<T, A, S, V>where T: Unpin,
impl<T, const A: u8, const S: bool, const V: u8> UnwindSafe for Ox<T, A, S, V>where T: UnwindSafe,
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