CAD97 / CAD97/pointer-utils

Ability to use `SliceWithHeader` in a newtype directly without `Box`

Open
#88 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
137
Forks
15
PR merge metrics
No merged PRs in 30d

Description

I want to make a pair of newtypes `MySlice(SliceWithHeader)` and `MyVec(HeaderType, Vec)`, so that `MySlice` is to `MyVec` as `[u8]` is to `Vec`.

It seems as per #69 that this crate offers only the ability to make `MySlice(Box>)` 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](https://stackoverflow.com/questions/64977525/how-can-i-create-newtypes-for-an-unsized-type-and-its-owned-counterpart-like-s). But it's not clear to me how to get both (i) no `Box`, and (ii) header. Any suggestion?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.