2 ms·
You maybe could write something like this: pub struct Fifo<T: AsMut<[u8]>> { and then back it with an array. I learned this trick from whitequark. (Though
by steveklabnik 6y ago
You maybe could write something like this:
pub struct Fifo<T: AsMut<[u8]>> {
and then back it with an array. I learned this trick from whitequark.
(Though maybe if you want something other than a slice of bytes, this gets harder... I've used this trick for ringbuffers/mmio only, personally, so YMMV.)
That being said real const generics will make this way nicer, eventually.