Crates.io | static-array |
lib.rs | static-array |
version | 0.5.0 |
source | src |
created_at | 2024-01-13 20:54:07.705326 |
updated_at | 2024-01-25 19:38:07.362643 |
description | A no-std rust crate providing a heap-allocated non-resizable type-checked array. |
homepage | https://github.com/Tomaso2468/static-array |
repository | https://github.com/Tomaso2468/static-array |
max_upload_size | |
id | 1098826 |
size | 36,154 |
A no-std rust crate providing a heap-allocated non-resizable type-checked array.
The documentation is available at https://docs.rs/static-array/0.5.0.
The following types are provided:
HeapArray
- A one dimensional heap-allocated array.HeapArray2D
- A two dimensional heap-allocated array.HeapArray3D
- A three dimensional heap-allocated array.This crate does not depend on std
but does require alloc
in order to create the array.
use static_array::HeapArray;
// Creates an array 16 MB (on 64 bit systems) in size
// which is larger than the standard linux stack size.
let array: HeapArray<usize, 2000000> = HeapArray::from_fn(|i| i);
assert_eq!(1247562, array[1247562]);
use static_array::HeapArray;
let array: HeapArray<usize, 2000000> = HeapArray::default();
assert_eq!(0, array[1247562]);