Struct std::boxed::IntermediateBox
[−]
[src]
pub struct IntermediateBox<T> where T: ?Sized {
ptr: *mut u8,
size: usize,
align: usize,
marker: PhantomData<*mut T>,
}
placement_in
): placement box design is still being worked out.
IntermediateBox
represents uninitialized backing storage for Box
.
FIXME (pnkfelix): Ideally we would just reuse Box<T>
instead of
introducing a separate IntermediateBox<T>
; but then you hit
issues when you e.g. attempt to destructure an instance of Box
,
since it is a lang item and so it gets special handling by the
compiler. Easier just to make this parallel type for now.
FIXME (pnkfelix): Currently the box
protocol only supports
creating instances of sized types. This IntermediateBox is
designed to be forward-compatible with a future protocol that
supports creating instances of unsized types; that is why the type
parameter has the ?Sized
generalization marker, and is also why
this carries an explicit size. However, it probably does not need
to carry the explicit alignment; that is just a work-around for
the fact that the align_of
intrinsic currently requires the
input type to be Sized (which I do not think is strictly
necessary).
Fields
ptr | Unstable ( placement_in ): placement box design is still being worked out. |
size | Unstable ( placement_in ): placement box design is still being worked out. |
align | Unstable ( placement_in ): placement box design is still being worked out. |
marker | Unstable ( placement_in ): placement box design is still being worked out. |