Struct multiboot2::builder::BoxedDst
source · pub struct BoxedDst<T: ?Sized> { /* private fields */ }
Expand description
A helper type to create boxed DST, i.e., tags with a dynamic size for the
builder. This is tricky in Rust. This type behaves similar to the regular
Box
type except that it ensure the same layout is used for the (explicit)
allocation and the (implicit) deallocation of memory. Otherwise, I didn’t
found any way to figure out the right layout for a DST. Miri always reported
issues that the deallocation used a wrong layout.
Technically, I’m certain this code is memory safe. But with this type, I also can convince miri that it is.
Trait Implementations§
impl<T: Eq + ?Sized> Eq for BoxedDst<T>
impl<T: ?Sized> StructuralEq for BoxedDst<T>
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for BoxedDst<T>where
T: RefUnwindSafe,
impl<T> !Send for BoxedDst<T>
impl<T> !Sync for BoxedDst<T>
impl<T: ?Sized> Unpin for BoxedDst<T>where
T: Unpin,
impl<T: ?Sized> UnwindSafe for BoxedDst<T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
source§impl<T> TagTrait for Twhere
T: Pointee<Metadata = ()>,
impl<T> TagTrait for Twhere
T: Pointee<Metadata = ()>,
source§fn dst_size(_: &Tag) -> <T as Pointee>::Metadata
fn dst_size(_: &Tag) -> <T as Pointee>::Metadata
Returns the amount of items in the dynamically sized portion of the
DST. Note that this is not the amount of bytes. So if the dynamically
sized portion is 16 bytes in size and each element is 4 bytes big, then
this function must return 4.
source§unsafe fn from_base_tag<'a>(tag: &Tag) -> &'a Self
unsafe fn from_base_tag<'a>(tag: &Tag) -> &'a Self
Creates a reference to a (dynamically sized) tag type in a safe way.
DST tags need to implement a proper
Self::dst_size
implementation. Read more