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