macro_rules! concat_slices {
    ([$T:ty]: $($s:expr),* $(,)?) => { ... };
}
Expand description

Concatenate const &[T] expressions into a static slice.

This macro takes any number of comma-separated &[T] expressions and yields an expression of type &'static [T] which is the result of all of the expressions concatenated left-to-right.

§Notes

  • This macro requires that the type of slice be specified before the comma separated expressions. This must be in the form [T]: where T is the the type.

    concat_slices!([usize]: /* ... */);
    concat_slices!([(u8, u8, u8)]: /* ... */);
  • This also works for custom types as long as the type implement Copy.

    #[derive(Clone, Copy)]
    struct i256(i128, i128);
    
    concat_slices!([i256]: /* ... */);

See the crate documentation for examples.