[][src]Struct aligned_bytes::AlignedBox

pub struct AlignedBox<T: ?Sized> { /* fields omitted */ }

Aligned heap allocation

Implementations

impl<T> AlignedBox<T>[src]

pub fn new(x: T, align: usize) -> Self[src]

Allocates memory on the heap with specified alignment and then places x into it.

This doesn't actually allocate if T is zero-sized.

impl<T: ?Sized> AlignedBox<T>[src]

pub fn into_raw(this: Self) -> (*mut T, usize)[src]

Consumes the box, returning a raw pointer and alignment.

pub unsafe fn from_raw(ptr: *mut T, align: usize) -> Self[src]

Constructs a aligned box from a raw pointer and alignment

Safety

  • ptr must be non-null and well aligned for align
  • ptr must be allocated with the global allocator

pub fn alignment(this: &Self) -> usize[src]

Returns the alignment of the box

Trait Implementations

impl<T: ?Sized + Debug> Debug for AlignedBox<T>[src]

impl<T: ?Sized> Deref for AlignedBox<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: ?Sized> DerefMut for AlignedBox<T>[src]

impl<T: ?Sized> Drop for AlignedBox<T>[src]

impl<T: ?Sized + RefUnwindSafe> RefUnwindSafe for AlignedBox<T>[src]

impl<T: ?Sized + Send> Send for AlignedBox<T>[src]

impl<T: ?Sized + Sync> Sync for AlignedBox<T>[src]

impl<T: ?Sized + UnwindSafe> UnwindSafe for AlignedBox<T>[src]

Auto Trait Implementations

impl<T: ?Sized> Unpin for AlignedBox<T> where
    T: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.