rust-unofficial / patterns

A catalogue of Rust design patterns, anti-patterns and idioms
https://rust-unofficial.github.io/patterns/
Mozilla Public License 2.0
7.85k stars 354 forks source link

In `Collections are Smart Pointers` data is `T` and not `[T]` #261

Closed CGMossa closed 3 years ago

CGMossa commented 3 years ago

Hey! Lovely book but in Collections are Smart Pointers there is


struct Vec<T> {
    data: T,
    //..
}

But shouldn't it be like

struct Vec<T> {
  data: [T], 
  // or
  data: RawVec<T>,

Or something like that?