array_manipulation

Crates.ioarray_manipulation
lib.rsarray_manipulation
version0.4.1
sourcesrc
created_at2022-07-20 23:17:42.717258
updated_at2022-07-23 02:16:45.743002
descriptionMethods for manipuling arrays in a Vec-like fashion. It will (probably) get into core once const expressions get less experimental.
homepagehttps://github.com/Alonely0/array_manipulation/
repositoryhttps://github.com/Alonely0/array_manipulation/
max_upload_size
id629236
size13,506
Guillem Jara (Alonely0)

documentation

https://docs.rs/array_manipulation

README

Manipulate Arrays as if they were vectors!

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.

Merging into core

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.

Commit count: 6

cargo fmt