Crates.io | reorder |
lib.rs | reorder |
version | 2.1.3 |
source | src |
created_at | 2018-12-12 02:45:16.789711 |
updated_at | 2022-03-26 22:26:13.244128 |
description | Reorder a slice based on a slice of indices |
homepage | |
repository | https://github.com/tiby312/reorder |
max_upload_size | |
id | 101546 |
size | 3,186 |
Simple crate that will reorder a slice based on a slice of indices without an auxiliary array.
Check it out on crates.io and github and docs.rs.
fn main() {
let (mut arr, mut ind, res) = (
[50, 40, 70, 60, 90, 10],
[03, 00, 04, 01, 02, 05],
[40, 60, 90, 50, 70, 10],
);
reorder_index(&mut arr, &mut ind);
assert_eq!(arr, res);
}