@@ -100,7 +100,24 @@ assert_eq!(vec.len(), 3);
100100assert_eq! (std :: mem :: size_of_val (& vec ), std :: mem :: size_of :: <usize >());
101101```
102102
103- ### Nightly
103+ ### ` alloc `
104+
105+ A ` HeapVec ` is just ` Vec ` , but built atop ` GenericVec ` ,
106+ meaning you get all the features of ` GenericVec ` for free! But this
107+ requries either the ` alloc ` or ` std ` feature to be enabled.
108+
109+ ``` rust
110+ use generic_vec :: {HeapVec , gvec};
111+ let mut vec : HeapVec <u32 > = gvec! [1 , 2 , 3 , 4 ];
112+ assert_eq! (vec . capacity (), 4 );
113+ vec . extend (& [5 , 6 , 7 , 8 ]);
114+
115+ assert_eq! (vec , [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ]);
116+
117+ vec . try_push (5 ). expect_err (" Tried to push past capacity!" );
118+ ```
119+
120+ ### ` nightly `
104121
105122If you enable the nightly feature then you gain access to
106123` ArrayVec ` and ` InitArrayVec ` . These are just like the
@@ -123,10 +140,6 @@ assert_eq!(array_vec, [10, 20, 30]);
123140The distinction between ` ArrayVec ` and ` InitArrayVec `
124141is identical to their slice counterparts.
125142
126- Finally a ` HeapVec ` is just ` Vec ` , but built atop ` GenericVec ` ,
127- meaning you get all the features of ` GenericVec ` for free! But this
128- requries either the ` alloc ` or ` std ` feature to be enabled.
129-
130143Note on the documentation: if the feature exists on ` Vec ` , then the documentation
131144is either exactly the same as ` Vec ` or slightly adapted to better fit ` GenericVec `
132145
0 commit comments