If I have a slice of
f64, what’s the best way to get a slice of
f32 from that?
I guess there’s actually two use cases:
1. Where the size is unknown and I’ll need to get an intermediate
If that’s the situation, is something like this the best way to do it?
let foo:Vec<f32> = values.iter().map(|n| *n as f32).collect();
2. Where the size is known
In this case, is there some sort of “memcpy with casting” builtin that lets me write to a stack-allocated array?
For example, instead of manually writing this:
let foo:[f32;4] = [ values as f32, values as f32, values as f32, values as f32, ];