←back to thread

611 points LorenDB | 1 comments | | HN request time: 0.253s | source
Show context
nyanpasu64 ◴[] No.43910223[source]
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.
replies(2): >>43910307 #>>43912786 #
1. conradludgate ◴[] No.43912786[source]
As 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.TransparentWr...