Minor tweaks to Pixel::read()

This commit is contained in:
Ivan Smirnov 2022-01-03 20:44:05 +03:00
parent 4633be5c52
commit 718e09e303

View file

@ -14,10 +14,14 @@ impl<const N: usize> Pixel<N> {
#[inline] #[inline]
pub fn read(&mut self, s: &[u8]) { pub fn read(&mut self, s: &[u8]) {
let mut i = 0; if s.len() == N {
while i < N { let mut i = 0;
self.0[i] = s[i]; while i < N {
i += 1; self.0[i] = s[i];
i += 1;
}
} else {
unreachable!();
} }
} }