| Crates.io | moving |
| lib.rs | moving |
| version | 0.1.2 |
| created_at | 2025-07-13 09:10:36.573693+00 |
| updated_at | 2025-07-13 09:57:28.059583+00 |
| description | Make elements of an array or a vector movable. |
| homepage | |
| repository | https://github.com/AWeirdDev/moving |
| max_upload_size | |
| id | 1750223 |
| size | 13,313 |
movingMake elements of an array or a vector movable with some simple magic.
Move elements of a vector an array.
use moving::move_vec_to_array;
let v = vec![0, 1, 2, 3, 4]; // 5 items
let arr = move_vec_to_array::<i16, 5>(v).unwrap();
assert_eq!(arr, [0, 1, 2, 3, 4]);
To make elements of an array or a vector movable, while the size is unknown, use movable:
use moving::{ MovableVec, movable };
let v = vec![0, 1, 2, 3, 4]; // 5 items
let arr = [0, 1, 2, 3, 4];
let mvv: MovableVec<i32> = movable(v);
let mvv_arr: MovableVec<i32> = movable(arr);
Alternatively, you can use ToMovable:
use moving::ToMovable;
some_vec.to_movable();
some_arr.to_movalbe();
To make elements of an array or a vector movable, while the size is known, use nmovable (notice the prefix "n"):
use moving::{ MovableArray, nmovable};
let v = vec![0, 1, 2, 3, 4]; // 5 items
let arr = [0, 1, 2, 3, 4];
let mvv: MovableArray<i32, 5> = nmovable(v).unwrap();
let mvv_arr: MovableArray<i32, 5> = nmovable(arr).unwrap();
Alternatively, you can use ToNMovable:
use moving::ToNMovable;
some_vec.to_nmovable()?;
some_arr.to_nmovable()?;