Crate boxarray

Source
Expand description

Safe way to allocate and initialize nested arrays directly on the heap inside a Box.

§Usage

In order to initialize a Boxed nested-array, simply call the boxarray function and give it the value (here v) to initialize with:

  let v = 7.0;
  let a: Box<[[[f64; 3]; 2]; 4]> = boxarray::boxarray(v);

The initialization can also be done with a function that takes the coordinates in nested tuples as arguments by using boxarray_ instead:

  let f = |((((), i), j), k)| (i+j*k) as usize;
  let a: Box<[[[usize; 3]; 2]; 4]> = boxarray::boxarray_(f);

Structs§

Array
Array constructor for CUList. Represent the outter-most array that contains the other nested arrays and its own size.
Value
Value constructor for CUList. Represend a single value not in an array.

Functions§

boxarray
The boxarray function allow to allocate nested arrays directly on the heap inside a Box and initialize it with a constant value of type E.
boxarray_
Same as boxarray but use a fonction that takes nested tuples of usize as coordinates and return a value of type E to initialize every cells.