macro_rules! slice {
([] $t:ty { $($x:expr),* $(,)? }) => { ... };
($t:ty ; $($x:expr),* $(,)?) => { ... };
($($x:expr),* $(,)?) => { ... };
}Expand description
Three forms — pick the one closest to your Go original:
slice!([]string{“a”, “b”}) // Go-shaped: []T{…} slice![string; “a”, “b”] // typed: T; values slice![1, 2, 3] // untyped: just values (vec! alias)
The typed and Go-shaped forms call .into() on each element so
&str literals become string, i32 literals widen to int64, etc.