Unfortunately funty::Numeric
cannot require/guarantee that Self::Bytes
is actually [u8; N]
, because it's not (yet?) allowed to write a signature like -> [u8; Self::BYTES]
(where BYTES
is an associated const: usize
item on the trait). The general bound you probably want to place on Self::Bytes
is probably AsRef<[u8]>
; the trait is implemented for all [T; N]
and allows you to call .as_ref()
to get &[T]
.
The trait you actually want for T
, though, is probably bytemuck::Pod
(for "plain ol' data"). This will allow you to use cast_slice
to directly go from &[T]
to &[u8]
without any copying.