pub type ThinArc<H, T> = Arc<HeaderSlice<H, T>>;Expand description
This is functionally equivalent to Arc<(H, [T])>
When you create an Arc containing a dynamically sized type like a slice, the Arc is
represented on the stack as a “fat pointer”, where the length of the slice is stored alongside
the Arc’s pointer. In some situations you may wish to have a thin pointer instead, perhaps
for FFI compatibility or space efficiency. ThinArc solves this by storing the length in the
allocation itself, via HeaderSlice.
Aliased Type§
#[repr(C)]pub struct ThinArc<H, T> {
pub(crate) p: NonNull<ArcInner<HeaderSlice<H, T>>>,
pub(crate) phantom: PhantomData<HeaderSlice<H, T>>,
}Fields§
§p: NonNull<ArcInner<HeaderSlice<H, T>>>§phantom: PhantomData<HeaderSlice<H, T>>