Macro index_fixed::index_fixed
[−]
[src]
macro_rules! index_fixed { (&mut $s:expr ; .. $e:expr) => { ... }; (&mut $s:expr ; $b:expr , ... $e:expr) => { ... }; (&mut $s:expr ; $b:expr , .. $e:expr) => { ... }; (& $s:expr ; .. $e:expr) => { ... }; (& $s:expr ; $b:expr , ... $e:expr) => { ... }; (& $s:expr ; $b:expr , .. $e:expr) => { ... }; }
Slices (via the Index trait & operation) into fixed size arrays
Will panic with the same rules as normal slicing.
Will not compile if bounds are not static.
Will not compile if end bound proceeds start bound.
Format
index_fixed! ( {&,&mut} <slice> ; .. <end>)
index_fixed! ( {&,&mut} <slice> ; <start> , .. <end>)
index_fixed! ( {&,&mut} <slice> ; <start> , ... <end>)
Examples
#[macro_use] extern crate index_fixed; fn main() { let my_slice = [1, 2, 3, 4]; let slice_of_2 = index_fixed!(&my_slice ; .. 2); assert_eq!(slice_of_2, &my_slice[..2]); }