3 ms·
You'd pair it with something like this https://docs.rs/unwrap-infallible/ https://docs.rs/unwrap-infallible/
by game-of-throws 4y ago
You'd pair it with something like this https://docs.rs/unwrap-infallible/ https://docs.rs/unwrap-infallible/
- dietrichepp 4y agoI don't see how that would work. d[0..4].try_into() The type of the result is something like: Result<[u8; 4], TryFromSliceError> How do I convert that into Result<[u8; 4], Infallible> As far as I can tell, Infallible is there because you're implementing a trait which returns an error, but you don't have an error to return at all.
- game-of-throws 4y agoIn jacobr1's comment we already have a way to get a Result<_, Infallible>. But converting a slice to an array returns a real error type, so my comment wouldn't apply. For your case just stick with `.try_into().unwrap()`. It's the easiest way. Unless of course someone on crates.io made a fancy crate with const generics.