Struct alloc::boxed::thin::WithHeader

source ·
#[repr(transparent)]
struct WithHeader<H>(NonNull<u8>, PhantomData<H>);
Expand description

A pointer to type-erased data, guaranteed to either be:

  1. NonNull::dangling(), in the case where both the pointee (T) and metadata (H) are ZSTs.
  2. A pointer to a valid T that has a header H directly before the pointed-to location.

Tuple Fields§

§0: NonNull<u8>§1: PhantomData<H>

Implementations§

source§

impl<H> WithHeader<H>

source

fn new<T>(header: H, value: T) -> WithHeader<H>

source

unsafe fn drop<T: ?Sized>(&self, value: *mut T)

source

fn header(&self) -> *mut H

source

fn value(&self) -> *mut u8

source

const fn header_size() -> usize

source

fn alloc_layout(value_layout: Layout) -> Result<(Layout, usize), LayoutError>

Auto Trait Implementations§

§

impl<H> RefUnwindSafe for WithHeader<H>where H: RefUnwindSafe,

§

impl<H> !Send for WithHeader<H>

§

impl<H> !Sync for WithHeader<H>

§

impl<H> Unpin for WithHeader<H>where H: Unpin,

§

impl<H> UnwindSafe for WithHeader<H>where H: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.