Struct ABox

pub struct ABox<T: ?Sized, A: Alignment = ConstAlign<CACHELINE_ALIGN>> { /* private fields */ }

Aligned box. See Box for more info.

Note: passing an alignment value of 0 or a power of two that is less than the minimum alignment will cause the vector to use the minimum valid alignment for the type T and alignment type A.

Implementations

impl<T, A: Alignment> ABox<T, A>

fn new(align: usize, value: T) -> Self

Creates a new [ABox<T>] containing value at an address aligned to align bytes.

fn alignment(&self) -> usize

Returns the alignment of the box.

impl<T: ?Sized, A: Alignment> ABox<T, A>

unsafe fn from_raw_parts(align: usize, ptr: *mut T) -> Self

Creates a new [ABox<T>] from its raw parts.

Safety

The arguments to this function must be acquired from a previous call to Self::into_raw_parts.

fn into_raw_parts(this: Self) -> (*mut T, usize)

Decomposes a [ABox<T>] into its raw parts: (ptr, alignment).

Trait Implementations

impl<T: ?Sized + Send, A: Alignment + Send> Send for ABox<T, A>

impl<T: ?Sized + Sync, A: Alignment + Sync> Sync for ABox<T, A>

impl<T: ?Sized, A: Alignment> AsMut<T> for ABox<T, A>

fn as_mut(&mut self) -> &mut T

impl<T: ?Sized, A: Alignment> AsRef<T> for ABox<T, A>

fn as_ref(&self) -> &T

impl<T: ?Sized, A: Alignment> Deref for ABox<T, A>

type Target = T;
fn deref(&self) -> &Self::Target

impl<T: ?Sized, A: Alignment> DerefMut for ABox<T, A>

fn deref_mut(&mut self) -> &mut Self::Target

impl<T: ?Sized, A: Alignment> Drop for ABox<T, A>

fn drop(&mut self)

impl<T: Clone, A: Alignment> Clone for ABox<T, A>

fn clone(&self) -> Self

impl<T: Clone, A: Alignment> Clone for ABox<[T], A>

fn clone(&self) -> Self

impl<T: Debug + ?Sized, A: Alignment> Debug for ABox<T, A>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<T: Eq + ?Sized, A: Alignment> Eq for ABox<T, A>

impl<T: Ord + ?Sized, A: Alignment> Ord for ABox<T, A>

fn cmp(&self, other: &Self) -> Ordering

impl<T: PartialEq + ?Sized, A: Alignment> PartialEq for ABox<T, A>

fn eq(&self, other: &Self) -> bool

impl<T: PartialOrd + ?Sized, A: Alignment> PartialOrd for ABox<T, A>

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

Auto Trait Implementations

impl<T, A> Freeze for ABox<T, A> where NonNull<T>: Freeze, A: Freeze, PhantomData<T>: Freeze, T: ?Sized,

impl<T, A> RefUnwindSafe for ABox<T, A> where NonNull<T>: RefUnwindSafe, A: RefUnwindSafe, PhantomData<T>: RefUnwindSafe, T: ?Sized,

impl<T, A> Unpin for ABox<T, A> where NonNull<T>: Unpin, A: Unpin, PhantomData<T>: Unpin, T: ?Sized,

impl<T, A> UnsafeUnpin for ABox<T, A> where NonNull<T>: UnsafeUnpin, A: UnsafeUnpin, PhantomData<T>: UnsafeUnpin, T: ?Sized,

impl<T, A> UnwindSafe for ABox<T, A> where NonNull<T>: UnwindSafe, A: UnwindSafe, PhantomData<T>: UnwindSafe, T: ?Sized,

Blanket Implementations

impl<P, T> Receiver for ABox<T, A> where P: Deref<Target = T> + ?Sized, T: ?Sized,

type Target = T;

impl<T> Any for ABox<T, A> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for ABox<T, A> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for ABox<T, A> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for ABox<T, A> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for ABox<T, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for ABox<T, A> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for ABox<T, A> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for ABox<T, A> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for ABox<T, A> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>