Suppose I had the following variable:
let mut n: &[((usize, usize), (usize, usize))];
I'd like to shuffle some data in this variable. I tried:
rng.shuffle(&mut n); // rng is of type rand::Rng
which of course leads to a compiler error complaining that the trait RandCore
isn't implemented for that type. I don't really mind implementing it, but I'd hate to have to define a trait implementation for every variation of that type (e.g. (usize, isize)
, ((usize, isize), (usize, isize), (isize, usize))
, etc) that I have in my code.
Is there another way of "automatically" defining this trait (like using macros of some sort)?