🌀 index_permute
A minimal, in-place, and non-cloning array permutation library for Rust.
This crate allows you to reorder a slice in place by an index array, even when the element type is not Clone or Copy. It ensures safety via a wrapper type PermuteIndex that checks index validity ahead of time.
✨ Features
- ✅ In-place permutation of non-
Copy, non-Clonedata. - ✅ Memory-safe: no element dropped or cloned during permutation.
- ✅ Index validation: ensures the index is a true permutation (
0..N). - ✅ Safe, ergonomic API.
- ✅
parallelfeature is defined, but it has limited speedup due to it's memory-bound nature. On benchmarks, it shows a 1.3x speedup on a 10 million element array.
Example
use PermuteIndex;
let index = try_new.unwrap;
let mut data = vec!;
order_by_index_inplace;
assert_eq!;
📦 Installation
Add this to your Cargo.toml:
[]
= 0.1