Ability to use `SliceWithHeader` in a newtype directly without `Box`
- Vorherrschende Sprache
- Rust
- Sterne
- 137
- Forks
- 15
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit der Prüfung von Issue #69 und der verknüpften Stack Overflow-Diskussion über newtypes für unsized types und deren besitzende Gegenstücke. Ermittle, ob das angeforderte Design sowohl einen Header als auch die direkte Verwendung eines newtype ohne Box, Rc oder Arc unterstützen kann; abgeschlossen ist die Aufgabe, wenn die Machbarkeit und die erforderliche API-Änderung klar sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100