macro_rules! vector {
    () => { ... };
    ($($x:expr),*) => { ... };
    ($x:expr; $n:expr) => { ... };
}
Expand description

The vector! macro enables easy construction of small vectors.

This is particularly useful when writing tests involving vectors. Note that the macro is just a convenient wrapper around the Vector constructors, and as a result the vector is still allocated on the heap.

Examples

#[macro_use]
extern crate rulinalg;

use rulinalg::vector::Vector;

// Construct a vector of f64
let vec = vector![1.0, 2.0, 3.0];

To construct vectors of other types, specify the type by the usual Rust syntax:

#[macro_use]
extern crate rulinalg;

use rulinalg::vector::Vector;

// Construct a vector of f32
let vec: Vector<f32> = vector![1.0, 2.0, 3.0];
// Or
let vec = vector![1.0, 2.0, 3.0f32];