]> git.lizzy.rs Git - rust.git/commitdiff
add a comment
authorNiko Matsakis <niko@alum.mit.edu>
Wed, 25 Jul 2018 10:43:35 +0000 (13:43 +0300)
committerNiko Matsakis <niko@alum.mit.edu>
Fri, 7 Sep 2018 15:34:41 +0000 (11:34 -0400)
src/librustc_data_structures/indexed_vec.rs

index f8992c991cc366c260eefc46b48000103e9659e3..09015957f99a20d2a8f1246570325ec45d507b2a 100644 (file)
@@ -48,6 +48,13 @@ impl Idx for u32 {
     fn index(self) -> usize { self as usize }
 }
 
+/// Creates a struct type `S` that can be used as an index with
+/// `IndexVec` and so on.  This struct can be constructed via `S::new`
+/// (given a `usize`) and converted to a usize with the `index()`
+/// method (from the `Idx` trait). Internally, the index uses a u32,
+/// so the index must not exceed `u32::MAX`. You can also customize
+/// things like the `Debug` impl, what traits are derived, and so
+/// forth.
 #[macro_export]
 macro_rules! newtype_index {
     // ---- public rules ----