@@ -17,15 +17,13 @@ use crate::{Idx, IndexSlice};
1717/// While it's possible to use `u32` or `usize` directly for `I`,
1818/// you almost certainly want to use a [`newtype_index!`]-generated type instead.
1919///
20- /// This allows to index the IndexVec with the new index type
21- ///
22- ///
20+ /// This allows to index the IndexVec with the new index type.
2321/// [`newtype_index!`]: ../macro.newtype_index.html
2422#[ derive( Clone , PartialEq , Eq , Hash ) ]
2523#[ repr( transparent) ]
2624pub struct IndexVec < I : Idx , T > {
2725 pub raw : Vec < T > ,
28- _marker : PhantomData < I > ,
26+ _marker : PhantomData < fn ( & I ) > ,
2927}
3028
3129impl < I : Idx , T > IndexVec < I , T > {
@@ -35,7 +33,7 @@ impl<I: Idx, T> IndexVec<I, T> {
3533 IndexVec :: from_raw ( Vec :: new ( ) )
3634 }
3735
38- /// Constructs a new `IndexVec<I, T>` from a `Vec<T>`
36+ /// Constructs a new `IndexVec<I, T>` from a `Vec<T>`.
3937 #[ inline]
4038 pub const fn from_raw ( raw : Vec < T > ) -> Self {
4139 IndexVec { raw, _marker : PhantomData }
@@ -65,7 +63,7 @@ impl<I: Idx, T> IndexVec<I, T> {
6563 IndexVec :: from_raw ( vec ! [ elem; universe. len( ) ] )
6664 }
6765
68- /// Creates a new IndexVec
66+ /// Creates a new IndexVec with n copies of the `elem`.
6967 #[ inline]
7068 pub fn from_elem_n ( elem : T , n : usize ) -> Self
7169 where
@@ -92,6 +90,7 @@ impl<I: Idx, T> IndexVec<I, T> {
9290 IndexSlice :: from_raw_mut ( & mut self . raw )
9391 }
9492
93+ /// Pushes an element to the array returning the index where it was pushed to.
9594 #[ inline]
9695 pub fn push ( & mut self , d : T ) -> I {
9796 let idx = self . next_index ( ) ;
0 commit comments