Skip to content

Commit c46f185

Browse files
committed
add a comment
1 parent 1242639 commit c46f185

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc_data_structures/indexed_vec.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ impl Idx for u32 {
4848
fn index(self) -> usize { self as usize }
4949
}
5050

51+
/// Creates a struct type `S` that can be used as an index with
52+
/// `IndexVec` and so on. This struct can be constructed via `S::new`
53+
/// (given a `usize`) and converted to a usize with the `index()`
54+
/// method (from the `Idx` trait). Internally, the index uses a u32,
55+
/// so the index must not exceed `u32::MAX`. You can also customize
56+
/// things like the `Debug` impl, what traits are derived, and so
57+
/// forth.
5158
#[macro_export]
5259
macro_rules! newtype_index {
5360
// ---- public rules ----

0 commit comments

Comments
 (0)