Minor tweaks to Pixel::read()
This commit is contained in:
parent
4633be5c52
commit
718e09e303
1 changed files with 8 additions and 4 deletions
|
@ -14,11 +14,15 @@ impl<const N: usize> Pixel<N> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn read(&mut self, s: &[u8]) {
|
pub fn read(&mut self, s: &[u8]) {
|
||||||
|
if s.len() == N {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < N {
|
while i < N {
|
||||||
self.0[i] = s[i];
|
self.0[i] = s[i];
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
unreachable!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in a new issue