Crates.io | array_manipulation |
lib.rs | array_manipulation |
version | 0.4.1 |
source | src |
created_at | 2022-07-20 23:17:42.717258 |
updated_at | 2022-07-23 02:16:45.743002 |
description | Methods for manipuling arrays in a Vec-like fashion. It will (probably) get into core once const expressions get less experimental. |
homepage | https://github.com/Alonely0/array_manipulation/ |
repository | https://github.com/Alonely0/array_manipulation/ |
max_upload_size | |
id | 629236 |
size | 13,506 |
This crate exposes 2 traits that allow manipulating arrays in a vec-like fashion.
Alternatives like ArrayVec operate over a [MaybeUninit<T>; N]
-like data structure and panic if the size is overflown. The point of this crate is allowing to "resize" arrays.
If you heavily depend on this crate, probably a linked list will be a much better fit, but this crate is still very useful for one-time operations, operations where using a linked list will give more problems than solutions, coercing arrays or devices where you can't allocate.
This crate works & performs exceptionally well when you have an array that you need to manipulate but you still need to use a fixed array later and not a Vec. In that situation you just avoided 1 malloc()
& 3 memcpy()
s best-case scenario and n malloc()
s, 3 memcpy()
s and a conditional worst-case scenario.
This crate depends on the experimental (not complete) feature generic-const-exprs, so the Pre-RFC is postponed until it doesn't get to a more mature state.