Crates.io | index_many |
lib.rs | index_many |
version | 0.6.1 |
source | src |
created_at | 2021-03-17 23:54:57.170973 |
updated_at | 2021-09-07 21:07:20.940853 |
description | A proof of concept for indexing an slice at multiple locations at once |
homepage | |
repository | https://github.com/Kimundi/index_many |
max_upload_size | |
id | 370312 |
size | 117,858 |
Proof of concept functions for (mutably) accessing a slice at multiple positions at once via an array of indices.
This crate implements multiple APIs:
[usize; N]
of indices.[usize; N]
of indices, but with an Result
based API.[I; N]
of indices, where I: SliceIndex<[T]>
.I: Indices<N>
that allows for more flexibility.use index_many::generic::index_many_mut;
let mut v = vec![1, 2, 3, 4, 5];
let [a, b, c] = index_many_mut(&mut v, [0, 2, 4]);
*a += 10;
*b += 100;
*c += 1000;
assert_eq!(v, vec![11, 2, 103, 4, 1005]);
The docs contain example functions with their x86_64 assembly codegen. See the [crate::_doc_assembly
] module.