Skip to content

Commit c4c5c2d

Browse files
committed
doc: add some array usage examples
1 parent 912ab64 commit c4c5c2d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/libstd/array.rs

+13
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,18 @@
99
// except according to those terms.
1010

1111
//! The fixed-size array type (`[T; n]`).
12+
//!
13+
//! Some usage examples:
14+
//!
15+
//! ```
16+
//! let array: [i32; 3] = [0, 1, 2];
17+
//!
18+
//! assert_eq!(0, array[0]);
19+
//! assert_eq!([0, 1], &array[..2]);
20+
//!
21+
//! for x in &array {
22+
//! println!("{}", x);
23+
//! }
24+
//! ```
1225
1326
#![doc(primitive = "array")]

0 commit comments

Comments
 (0)