Hi!
I only just discovered you could do <u8; 3>::try_from(&slice)
... which makes me ask, can I do something like this?
fn magic<[u8; T]>(&self) -> Result<[u8; T], E> {
let bytes = &self.data[0..T];
<u8; T>::try_from(bytes)
}
Obviously T
is not a type here, it's a value but I've used it as a demo of what I want to achieve. Basically I want to call let v: [u8; 5] = s.magic::<u8; 5>().unwrap()
.