4 ms·
The problem I've always had with unit type wrappers is you can't convert between a &[f32] and a &[Amplitude<f32>] like you can convert a single scalar value.
by nyanpasu64 1y ago
The problem I've always had with unit type wrappers is you can't convert between a &[f32] and a &[Amplitude<f32>] like you can convert a single scalar value.
- fvncc 1y agoThere are libraries that help with these conversions. See e.g.: https://docs.rs/bytemuck/latest/bytemuck/trait.TransparentWrapper.html https://docs.rs/bytemuck/latest/bytemuck/trait.TransparentWr...
- conradludgate 1y agoAs long as the wrapper is marked as transparent, it's safe to transmute the wrappers. If you don't want unsafe, you can make use of this safe derive: https://docs.rs/bytemuck/latest/bytemuck/trait.TransparentWrapper.html https://docs.rs/bytemuck/latest/bytemuck/trait.TransparentWr...