pointer-utils
pointer-utils copied to clipboard
Ability to use `SliceWithHeader` in a newtype directly without `Box`
I want to make a pair of newtypes MySlice(SliceWithHeader<HeaderType, u8>)
and MyVec(HeaderType, Vec<u8>)
, so that MySlice
is to MyVec
as [u8]
is to Vec<u8>
.
It seems as per #69 that this crate offers only the ability to make MySlice(Box<SliceWithHeader<...>>)
with Box
(or Rc
, Arc
) but not without the Box
.
I know it's possible to do this without the header as per How can I create newtypes for an unsized type and its owned counterpart (like str
and String
) in safe Rust? - Stack Overflow. But it's not clear to me how to get both (i) no Box
, and (ii) header. Any suggestion?