about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTshepang Lekhonkhobe <tshepang@gmail.com>2015-07-06 01:42:05 +0200
committerTshepang Lekhonkhobe <tshepang@gmail.com>2015-07-06 01:42:05 +0200
commitc4c5c2dd20aaaddb7c0afdba06ec319340842443 (patch)
tree994ae2c4f579f587deb7dc8664c49eb894356f05
parent912ab64a0de2c121a1c9f10bb1dbe75983b78c73 (diff)
downloadrust-c4c5c2dd20aaaddb7c0afdba06ec319340842443.tar.gz
rust-c4c5c2dd20aaaddb7c0afdba06ec319340842443.zip
doc: add some array usage examples
-rw-r--r--src/libstd/array.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstd/array.rs b/src/libstd/array.rs
index a6b8cd71a3b..6887e398fd4 100644
--- a/src/libstd/array.rs
+++ b/src/libstd/array.rs
@@ -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")]