If I have an function that requires a slice of type &[usize]
but I have a slice of type &[u8]
, how do I cast from one type to the other? It seems like it should be easy to cast u8
to usize
but I'm not finding a simple solution.
Something like:
use rand::{SeedableRng, StdRng};
// seed = &[1, 2, 3] with type u8
let rng: StdRng = SeedableRng::from_seed(seed);