Crates.io | boxarray |
lib.rs | boxarray |
version | 1.3.0 |
source | src |
created_at | 2023-09-24 02:45:09.69565 |
updated_at | 2023-10-16 08:00:26.82055 |
description | Safe way to allocate and initialize nested arrays directly on the heap in Rust. |
homepage | https://github.com/xayon40-12/boxarray.git |
repository | https://github.com/xayon40-12/boxarray.git |
max_upload_size | |
id | 981662 |
size | 11,255 |
Safe way to allocate and initialize nested arrays directly on the heap in Rust.
To use boxarray
in your Rust project, simply add it as a dependency in your Cargo.toml
:
[dependencies]
boxarray = "1.3.0"
Then import and use it in your project:
use boxarray::boxarray;
use boxarray::boxarray_;
fn main() {
let v = 7.0;
let a: Box<[[[f64; 3]; 2]; 4]> = boxarray(v);
println!("{a:?}");
let f = |((((), i), j), k)| (i+j*k) as usize;
let a: Box<[[[usize; 3]; 2]; 4]> = boxarray_(f);
println!("{a:?}");
}