Struct WithHeader
#[repr(transparent)]
pub(in ::boxed::thin) struct WithHeader<H>(pub(in ::boxed::thin) NonNull<u8>, pub(in ::boxed::thin) PhantomData<H>);
A pointer to type-erased data, guaranteed to either be:
NonNull::dangling(), in the case where both the pointee (T) and metadata (H) are ZSTs.- A pointer to a valid
Tthat has a headerHdirectly before the pointed-to location.
Fields
0: NonNull<u8>1: PhantomData<H>
Implementations
impl<H> WithHeader<H>
fn new<T>(header: H, value: T) -> WithHeader<H>fn try_new<T>(header: H, value: T) -> Result<WithHeader<H>, AllocError>Non-panicking version of
new. Any error is returned asErr(core::alloc::AllocError).fn new_unsize_zst<Dyn, T>(value: T) -> WithHeader<H> where Dyn: Pointee<Metadata = H> + ?Sized, T: Unsize<Dyn>,unsafe fn drop<T: ?Sized>(&self, value: *mut T)fn header(&self) -> *mut Hfn value(&self) -> *mut u8const fn header_size() -> usizefn alloc_layout(value_layout: Layout) -> Result<(Layout, usize), LayoutError>
Auto Trait Implementations
impl<H> !Send for WithHeader<H>
impl<H> !Sync for WithHeader<H>
impl<H> Freeze for WithHeader<H>
where
PhantomData<H>: Freeze,
impl<H> RefUnwindSafe for WithHeader<H>
where
PhantomData<H>: RefUnwindSafe,
impl<H> Unpin for WithHeader<H>
where
PhantomData<H>: Unpin,
impl<H> UnsafeUnpin for WithHeader<H>
where
PhantomData<H>: UnsafeUnpin,
impl<H> UnwindSafe for WithHeader<H>
where
PhantomData<H>: UnwindSafe,
Blanket Implementations
impl<T> Any for WithHeader<H>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for WithHeader<H>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for WithHeader<H>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for WithHeader<H>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for WithHeader<H>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for WithHeader<H>
impl<T, U> Into<U> for WithHeader<H>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for WithHeader<H>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for WithHeader<H>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>