Skip to content

Ability to use SliceWithHeader in a newtype directly without Box #88

Description

@ggutoski

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions