You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're very sloppy about what is a nibble and what is an array of constructed u8 arrays. Consider making this more explicit within the codebase by wrapping nibbles into a newtype.
I think this would be great if we had `Item = Nibble` where `#[repr(transparent)] struct Nibble(u8)` (where you can only create the nibble if it's within the correct bounds).
Instead, I think something like this would make the call more explicit
/// CAUTION: only use with nibble iterators pub(crate)fnnibbles_into_bytes<Iter:Iterator<Item = u8>>(iter:Iter) -> Vec<u8>{letmut data = Vec::with_capacity(self.size_hint().0 / 2);whilelet(Some(hi),Some(lo)) = (self.next(),self.next()){
data.push((hi << 4) + lo);}
data
}
The text was updated successfully, but these errors were encountered:
We're very sloppy about what is a nibble and what is an array of constructed u8 arrays. Consider making this more explicit within the codebase by wrapping nibbles into a newtype.
Originally posted by @richardpringle in #435 (comment)
Instead, I think something like this would make the call more explicit
The text was updated successfully, but these errors were encountered: