| 1 | use craterust-analyzer cargo qoi 0.4.1 crate/::constsrust-analyzer cargo qoi 0.4.1 consts/::{QOI_OP_DIFFrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_DIFF., QOI_OP_LUMArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_LUMA., QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA.}; |
| 2 | use craterust-analyzer cargo qoi 0.4.1 crate/::errorrust-analyzer cargo qoi 0.4.1 error/::Resultrust-analyzer cargo qoi 0.4.1 error/Result#; |
| 3 | use craterust-analyzer cargo qoi 0.4.1 crate/::utilsrust-analyzer cargo qoi 0.4.1 utils/::Writerrust-analyzer cargo qoi 0.4.1 utils/Writer#; |
| 4 | use bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::{castrust-analyzer cargo bytemuck 1.25.2 cast()., Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod#}; |
| 5 | |
| 6 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 7 | #[repr(transparent)] |
| 8 | pub struct Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<const N: usize>([u8; N]); |
| 9 | |
| 10 | impl<const N: usize> Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<N> { |
| 11 | #[inline] |
| 12 | pub const fn newrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]new().() -> Selfrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`] { |
| 13 | Selfrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]([0; N]) |
| 14 | } |
| 15 | |
| 16 | #[inline] |
| 17 | pub fn readrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]read().(&mut self, s: &[u8]) { |
| 18 | if s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().N { |
| 19 | let mut i = 0; |
| 20 | while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().N { |
| 21 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 22 | i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 23 | } |
| 24 | } else { |
| 25 | unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | #[inline] |
| 30 | pub fn updaterust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]update().<const M: usize>(&mut self, px: Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<M>) { |
| 31 | let mut i = 0; |
| 32 | while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().M && i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().N { |
| 33 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = px.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 34 | i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | #[inline] |
| 39 | pub fn update_rgbrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]update_rgb().(&mut self, r: u8, g: u8, b: u8) { |
| 40 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = r; |
| 41 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = g; |
| 42 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = b; |
| 43 | } |
| 44 | |
| 45 | #[inline] |
| 46 | pub fn update_rgbarust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]update_rgba().(&mut self, r: u8, g: u8, b: u8, a: u8) { |
| 47 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = r; |
| 48 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = g; |
| 49 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = b; |
| 50 | if N rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().4 { |
| 51 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = a; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | #[inline] |
| 56 | pub fn update_diffrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]update_diff().(&mut self, b1: u8) { |
| 57 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().((b1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x03).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(2); |
| 58 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().((b1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().2) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x03).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(2); |
| 59 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(b1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x03).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(2); |
| 60 | } |
| 61 | |
| 62 | #[inline] |
| 63 | pub fn update_lumarust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]update_luma().(&mut self, b1: u8, b2: u8) { |
| 64 | let vg = (b1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x3f).wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(32); |
| 65 | let vg_8 = vg.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(8); |
| 66 | let vr = vg_8.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().((b2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x0f); |
| 67 | let vb = vg_8.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(b2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x0f); |
| 68 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(vr); |
| 69 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(vg); |
| 70 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(vb); |
| 71 | } |
| 72 | |
| 73 | #[inline] |
| 74 | pub const fn as_rgbarust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]as_rgba().(self, with_a: u8) -> Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<4> { |
| 75 | let mut i = 0; |
| 76 | let mut out = Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#::newrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]new().(); |
| 77 | while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().N { |
| 78 | out.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 79 | i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 80 | } |
| 81 | if N rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().4 { |
| 82 | out.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = with_a; |
| 83 | } |
| 84 | out |
| 85 | } |
| 86 | |
| 87 | #[inline] |
| 88 | pub const fn rrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]r().(self) -> u8 { |
| 89 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). |
| 90 | } |
| 91 | |
| 92 | #[inline] |
| 93 | pub const fn grust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]g().(self) -> u8 { |
| 94 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). |
| 95 | } |
| 96 | |
| 97 | #[inline] |
| 98 | pub const fn brust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]b().(self) -> u8 { |
| 99 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). |
| 100 | } |
| 101 | |
| 102 | #[inline] |
| 103 | pub const fn with_arust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]with_a().(mut self, value: u8) -> Selfrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`] { |
| 104 | if N rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().4 { |
| 105 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = value; |
| 106 | } |
| 107 | self |
| 108 | } |
| 109 | |
| 110 | #[inline] |
| 111 | pub const fn a_orrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]a_or().(self, value: u8) -> u8 { |
| 112 | if N rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().4 { |
| 113 | value |
| 114 | } else { |
| 115 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | #[inline] |
| 120 | #[allow(clippy::cast_lossless, clippy::cast_possible_truncation)] |
| 121 | pub fn hash_indexrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]hash_index().(self) -> u8 |
| 122 | where |
| 123 | [u8; N]: Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod#, |
| 124 | { |
| 125 | // credits for the initial idea: @zakarumych |
| 126 | let v = if N rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().4 { |
| 127 | u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(castrust-analyzer cargo bytemuck 1.25.2 cast().(self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.)) |
| 128 | } else { |
| 129 | u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().([self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., 0xff]) |
| 130 | } as u64; |
| 131 | let s = ((v rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().0xff00_ff00) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`Shl<i32>`]shl().32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitOr<Self>`]bitor().(v rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u64][`BitAnd<Self>`]bitand().0x00ff_00ff); |
| 132 | s.wrapping_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]wrapping_mul().(0x0300_0700_0005_000b_u64).to_lerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]to_le().().swap_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]swap_bytes().() as u8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().63 |
| 133 | } |
| 134 | |
| 135 | #[inline] |
| 136 | pub fn rgb_addrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]rgb_add().(&mut self, r: u8, g: u8, b: u8) { |
| 137 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(r); |
| 138 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(g); |
| 139 | self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(b); |
| 140 | } |
| 141 | |
| 142 | #[inline] |
| 143 | pub fn encode_intorust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]encode_into().<W: Writerrust-analyzer cargo qoi 0.4.1 utils/Writer#>(&self, px_prev: Selfrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`], buf: W) -> Resultrust-analyzer cargo qoi 0.4.1 error/Result#<W> { |
| 144 | if N rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().3 || self.a_orrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]a_or().(0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().px_prev.a_orrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]a_or().(0) { |
| 145 | let vg = self.grust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]g().().wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(px_prev.grust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]g().()); |
| 146 | let vg_32 = vg.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(32); |
| 147 | if vg_32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().63 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().63 { |
| 148 | let vr = self.rrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]r().().wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(px_prev.rrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]r().()); |
| 149 | let vb = self.brust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]b().().wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(px_prev.brust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]b().()); |
| 150 | let vg_r = vr.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(vg); |
| 151 | let vg_b = vb.wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_sub().(vg); |
| 152 | let (vr_2, vg_2, vb_2) = |
| 153 | (vr.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(2), vg.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(2), vb.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(2)); |
| 154 | if vr_2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vg_2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vb_2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().3 { |
| 155 | buf.write_onerust-analyzer cargo qoi 0.4.1 utils/Writer#write_one().(QOI_OP_DIFFrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_DIFF. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vr_2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vg_2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vb_2) |
| 156 | } else { |
| 157 | let (vg_r_8, vg_b_8) = (vg_r.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(8), vg_b.wrapping_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]wrapping_add().(8)); |
| 158 | if vg_r_8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vg_b_8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().15 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().15 { |
| 159 | buf.write_manyrust-analyzer cargo qoi 0.4.1 utils/Writer#write_many().(&[QOI_OP_LUMArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_LUMA. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vg_32, vg_r_8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOr<Self>`]bitor().vg_b_8]) |
| 160 | } else { |
| 161 | buf.write_manyrust-analyzer cargo qoi 0.4.1 utils/Writer#write_many().(&[QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., self.rrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]r().(), self.grust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]g().(), self.brust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]b().()]) |
| 162 | } |
| 163 | } |
| 164 | } else { |
| 165 | buf.write_manyrust-analyzer cargo qoi 0.4.1 utils/Writer#write_many().(&[QOI_OP_RGBrust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGB., self.rrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]r().(), self.grust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]g().(), self.brust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]b().()]) |
| 166 | } |
| 167 | } else { |
| 168 | buf.write_manyrust-analyzer cargo qoi 0.4.1 utils/Writer#write_many().(&[QOI_OP_RGBArust-analyzer cargo qoi 0.4.1 consts/QOI_OP_RGBA., self.rrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]r().(), self.grust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]g().(), self.brust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]b().(), self.a_orrust-analyzer cargo qoi 0.4.1 pixel/impl#[`Pixel<N>`]a_or().(0xff)]) |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | impl<const N: usize> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<N>> for [u8; N] { |
| 174 | #[inline(always)] |
| 175 | fn fromrust-analyzer cargo qoi 0.4.1 pixel/impl#[`[u8; N]`][`From<Pixel<N>>`]from().(px: Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<N>) -> Selfrust-analyzer cargo qoi 0.4.1 pixel/impl#[`[u8; N]`][`From<Pixel<N>>`] { |
| 176 | px.0rust-analyzer cargo qoi 0.4.1 pixel/Pixel#0. |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | pub trait SupportedChannelsrust-analyzer cargo qoi 0.4.1 pixel/SupportedChannels# {} |
| 181 | |
| 182 | impl SupportedChannelsrust-analyzer cargo qoi 0.4.1 pixel/SupportedChannels# for Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<3> {} |
| 183 | impl SupportedChannelsrust-analyzer cargo qoi 0.4.1 pixel/SupportedChannels# for Pixelrust-analyzer cargo qoi 0.4.1 pixel/Pixel#<4> {} |