#[repr(C)]pub struct DynStruct<Header, Tail: ?Sized> {
pub header: Header,
pub tail: Tail,
}Fields§
§header: Header§tail: TailImplementations§
Source§impl<Header, Tail: ?Sized> DynStruct<Header, Tail>
impl<Header, Tail: ?Sized> DynStruct<Header, Tail>
Sourcepub fn new(header: Header, tail: DynArg<Tail>) -> Box<Self>
pub fn new(header: Header, tail: DynArg<Tail>) -> Box<Self>
Allocate a new DynStruct on the heap.
Sourcepub unsafe fn transmute<T: Pointee<Metadata = <Tail as Pointee>::Metadata> + ?Sized>(
self: Box<Self>,
) -> Box<T>
pub unsafe fn transmute<T: Pointee<Metadata = <Tail as Pointee>::Metadata> + ?Sized>( self: Box<Self>, ) -> Box<T>
SAFETY: DynStruct<Header, Tail> and T must have the same exact memory layout,
including fields, size, and alignment. They must also have the same pointer metadata.
This function checks at compile-type the pointer metadata part. Use [more_unsafe_transmute] if that check fails for some reason.
Sourcepub unsafe fn more_unsafe_transmute<T: ?Sized>(self: Box<Self>) -> Box<T>
pub unsafe fn more_unsafe_transmute<T: ?Sized>(self: Box<Self>) -> Box<T>
SAFETY: DynStruct<Header, Tail> and T must have the same exact memory layout,
including fields, size, and alignment. They must also have the same pointer metadata.
This function does not check at compile-type the pointer metadata part. Make sure the metadatas are the same or you will get some confusing runtime bugs.
Trait Implementations§
Source§impl<Header: Ord, Tail: Ord + ?Sized> Ord for DynStruct<Header, Tail>
impl<Header: Ord, Tail: Ord + ?Sized> Ord for DynStruct<Header, Tail>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Header: PartialOrd, Tail: PartialOrd + ?Sized> PartialOrd for DynStruct<Header, Tail>
impl<Header: PartialOrd, Tail: PartialOrd + ?Sized> PartialOrd for DynStruct<Header, Tail>
impl<Header: Copy, Tail: Copy + ?Sized> Copy for DynStruct<Header, Tail>
impl<Header: Eq, Tail: Eq + ?Sized> Eq for DynStruct<Header, Tail>
impl<Header, Tail: ?Sized> StructuralPartialEq for DynStruct<Header, Tail>
Auto Trait Implementations§
impl<Header, Tail> Freeze for DynStruct<Header, Tail>
impl<Header, Tail> RefUnwindSafe for DynStruct<Header, Tail>
impl<Header, Tail> Send for DynStruct<Header, Tail>
impl<Header, Tail> Sync for DynStruct<Header, Tail>
impl<Header, Tail> Unpin for DynStruct<Header, Tail>
impl<Header, Tail> UnwindSafe for DynStruct<Header, Tail>
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