mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
doc: add some array usage examples
This commit is contained in:
parent
912ab64a0d
commit
c4c5c2dd20
@ -9,5 +9,18 @@
|
||||
// except according to those terms.
|
||||
|
||||
//! The fixed-size array type (`[T; n]`).
|
||||
//!
|
||||
//! Some usage examples:
|
||||
//!
|
||||
//! ```
|
||||
//! let array: [i32; 3] = [0, 1, 2];
|
||||
//!
|
||||
//! assert_eq!(0, array[0]);
|
||||
//! assert_eq!([0, 1], &array[..2]);
|
||||
//!
|
||||
//! for x in &array {
|
||||
//! println!("{}", x);
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
#![doc(primitive = "array")]
|
||||
|
Loading…
Reference in New Issue
Block a user