published: 13th of February 2022
An array is a sequence of values, of the same type. A array is defined with square brackets [].
// Create an array with 2 elements.
let stuff_and_things = ["stuff", "things"];
// Annotate the types of the arrays values and specify the array size.
let stuff_and_things: [&str; 2] = ["stuff", "things"];
// Array elements are accessed with square `[]` brackets
// and their `index` number.
println!("{}", stuff_and_things[0]); // => stuff
println!("{}", stuff_and_things[1]); // => things
// All the elements of an array can be destructured into a pattern.
let [a, b] = stuff_and_things;
https://www.manning.com/books/rust-in-action