Module forester::vec2d [−][src]
A row-major contiguous two-dimensional array type, written Vec2D<T>
.
Vec2D
implements indexing by a tuple (row, col)
to get a single item, or by a scalar to
get the slice of a row. Iteration is implemented over rows.
Examples
Create an empty [Vec2D<T>
] with [new
]:
let x: Vec2D<i32> = Vec2D::new();
Or by taking ownership of a Vec<T>
and specifying the number of columns:
let x = Vec2D::from_vec(vec![11, 12, 13, 24, 25, 26], 2);
Or by copying data from a slice:
let x = Vec2D::from_slice(&[11, 12, 21, 22, 31, 32], 3);
Note: The length of the vector/slice must be an integer multiple of the number of columns.
Structs
Vec2D |
A row-major contiguous two-dimensional array. |