[−][src]Macro multindex::multiget_mut
For mutable indexing of slices with multiple indices/ranges.
This macro returns None
if the indices/ranges are
out of bounds for the passed slice,
returns Some
if they are in bounds.
Shared docs
The indexing macros share a lot in common, because of that you can look here for additional documentation.
Example
use multindex::multiget_mut; let mut arr = [3u8, 5, 8, 13, 21, 34]; assert_eq!(multiget_mut!(arr; 0, 2, 4), Some((&mut 3, &mut 8, &mut 21))); // The `2..=4` here returns a `&mut [u8; 3]`, since it's a bounded range. assert_eq!(multiget_mut!(arr; 0, 2..=4), Some((&mut 3, &mut [8, 13, 21]))); // The `..` here returns a `&mut [u8]`, since it's a trailing unbounded range assert_eq!(multiget_mut!(arr; ..2, ..), Some((&mut [3, 5], &mut [8, 13, 21, 34][..]))); assert_eq!(multiget_mut!(arr; 0, 1, 10), None); assert_eq!(multiget_mut!(arr; 0..10), None);