[−][src]Macro crabsformer::vector
Creates a numeric vector containing the arguments.
vector!
allows numeric vector to be defined with
the same syntax as array expressions.
There are two forms of this macro:
- Create a numeric vector containing a given list of elements:
let x = vector![1, 2, 3]; assert_eq!(x[0], 1); assert_eq!(x[1], 2); assert_eq!(x[2], 3);
- Create a numeric vector from a given element and length:
let x = vector![1; 3]; assert_eq!(x, vector![1, 1, 1]);