Debian Codegraph @

src/reader/converter.rs

raw symbols SCIP
1 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#;
2 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#;
3 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/;
4 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/;
5
6 use superrust-analyzer cargo gif 0.14.2 reader/::decoderrust-analyzer cargo gif 0.14.2 reader/decoder/::{DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#, OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#, PLTE_CHANNELSrust-analyzer cargo gif 0.14.2 reader/decoder/PLTE_CHANNELS.};
7 use craterust-analyzer cargo gif 0.14.2 crate/::commonrust-analyzer cargo gif 0.14.2 common/::Framerust-analyzer cargo gif 0.14.2 common/Frame#;
8 use craterust-analyzer cargo gif 0.14.2 crate/::MemoryLimitrust-analyzer cargo gif 0.14.2 reader/MemoryLimit#;
9
10 pub(craterust-analyzer cargo gif 0.14.2 crate/) const N_CHANNELSrust-analyzer cargo gif 0.14.2 reader/converter/N_CHANNELS.: usize = 4;
11
12 /// Output mode for the image data
13 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
14 #[repr(u8)]
15 pub enum ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput# {
16 /// The decoder expands the image data to 32bit RGBA.
17 /// This affects:
18 ///
19 /// - The buffer buffer of the `Frame` returned by [`Decoder::read_next_frame`].
20 /// - `Decoder::fill_buffer`, `Decoder::buffer_size` and `Decoder::line_length`.
21 RGBArust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#RGBA# = 0,
22 /// The decoder returns the raw indexed data.
23 Indexedrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#Indexed# = 1,
24 }
25
26 pub(craterust-analyzer cargo gif 0.14.2 crate/) type FillBufferCallbackrust-analyzer cargo gif 0.14.2 reader/converter/FillBufferCallback#<'a> =
27 &'a mut dyn FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&mut OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#>;
28
29 /// Deinterlaces and expands to RGBA if needed
30 pub(craterust-analyzer cargo gif 0.14.2 crate/) struct PixelConverterrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter# {
31 color_outputrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#color_output.: ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#,
32 bufferrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#buffer.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>,
33 global_paletterust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#global_palette.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>>,
34 }
35
36 impl PixelConverterrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter# {
37 pub(craterust-analyzer cargo gif 0.14.2 crate/) const fn newrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]new().(color_output: ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#) -> Selfrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter] {
38 Selfrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter] {
39 color_outputrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#color_output.,
40 bufferrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#buffer.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
41 global_paletterust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#global_palette.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
42 }
43 }
44
45 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn check_buffer_sizerust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]check_buffer_size().(
46 &self,
47 frame: &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>,
48 memory_limit: &MemoryLimitrust-analyzer cargo gif 0.14.2 reader/MemoryLimit#,
49 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
50 let pixel_bytes = memory_limit
51 .buffer_sizerust-analyzer cargo gif 0.14.2 reader/impl#[MemoryLimit]buffer_size().(self.color_outputrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#color_output., frame.widthrust-analyzer cargo gif 0.14.2 common/Frame#width., frame.heightrust-analyzer cargo gif 0.14.2 common/Frame#height.)
52 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::OutOfMemoryrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#OutOfMemory#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
53
54 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(
55 pixel_bytes,
56 self.buffer_sizerust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]buffer_size().(frame).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
57 "Checked computation diverges from required buffer size"
58 );
59 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(pixel_bytes)
60 }
61
62 #[inline]
63 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn read_framerust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]read_frame().(
64 &mut self,
65 frame: &mut Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>,
66 data_callback: FillBufferCallbackrust-analyzer cargo gif 0.14.2 reader/converter/FillBufferCallback#<'_>,
67 memory_limit: &MemoryLimitrust-analyzer cargo gif 0.14.2 reader/MemoryLimit#,
68 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
69 let pixel_bytes = self.check_buffer_sizerust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]check_buffer_size().(frame, memory_limit)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
70 let mut vec = match memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().(&mut frame.bufferrust-analyzer cargo gif 0.14.2 common/Frame#buffer., Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(&[])) {
71 // reuse buffer if possible without reallocating
72 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(mut vec) if vec.capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]capacity().() 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().pixel_bytes => {
73 vec.resizerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]resize().(pixel_bytes, 0);
74 vec
75 }
76 // resizing would realloc anyway, and 0-init is faster than a copy
77 _ => vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; pixel_bytes],
78 };
79 self.read_into_bufferrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]read_into_buffer().(frame, &mut vec, data_callback)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
80 frame.bufferrust-analyzer cargo gif 0.14.2 common/Frame#buffer. = Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(vec);
81 frame.interlacedrust-analyzer cargo gif 0.14.2 common/Frame#interlaced. = false;
82 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
83 }
84
85 #[inline]
86 pub(craterust-analyzer cargo gif 0.14.2 crate/) const fn buffer_sizerust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]buffer_size().(&self, frame: &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> {
87 self.line_lengthrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]line_length().(frame).checked_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]checked_mul().(frame.heightrust-analyzer cargo gif 0.14.2 common/Frame#height. as usize)
88 }
89
90 #[inline]
91 pub(craterust-analyzer cargo gif 0.14.2 crate/) const fn line_lengthrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]line_length().(&self, frame: &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>) -> usize {
92 use selfrust-analyzer cargo gif 0.14.2 reader/converter/::ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#::{Indexedrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#Indexed#, RGBArust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#RGBA#};
93 match self.color_outputrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#color_output. {
94 RGBArust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#RGBA# => frame.widthrust-analyzer cargo gif 0.14.2 common/Frame#width. as usize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().N_CHANNELSrust-analyzer cargo gif 0.14.2 reader/converter/N_CHANNELS.,
95 Indexedrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#Indexed# => frame.widthrust-analyzer cargo gif 0.14.2 common/Frame#width. as usize,
96 }
97 }
98
99 /// Use `read_into_buffer` to deinterlace
100 #[inline(never)]
101 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn fill_bufferrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]fill_buffer().(
102 &mut self,
103 current_frame: &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>,
104 mut buf: &mut [u8],
105 data_callback: FillBufferCallbackrust-analyzer cargo gif 0.14.2 reader/converter/FillBufferCallback#<'_>,
106 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<bool, DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
107 loop {
108 let decode_into = match self.color_outputrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#color_output. {
109 // When decoding indexed data, LZW can write the pixels directly
110 ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#::Indexedrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#Indexed# => &mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().,
111 // When decoding RGBA, the pixel data will be expanded by a factor of 4,
112 // and it's simpler to decode indexed pixels to another buffer first
113 ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#::RGBArust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#RGBA# => {
114 let buffer_size = buf.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 ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().N_CHANNELSrust-analyzer cargo gif 0.14.2 reader/converter/N_CHANNELS.;
115 if buffer_size 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().0 {
116 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::formatrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]format().("odd-sized buffer"));
117 }
118 if self.bufferrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#buffer..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() 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().buffer_size {
119 self.bufferrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#buffer..resizerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]resize().(buffer_size, 0);
120 }
121 &mut self.bufferrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#buffer.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#buffer_size]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().
122 }
123 };
124 match data_callback(&mut OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Slicerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#Slice#(decode_into))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
125 0 => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false),
126 bytes_decoded => {
127 match self.color_outputrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#color_output. {
128 ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#::RGBArust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#RGBA# => {
129 let transparent = current_frame.transparentrust-analyzer cargo gif 0.14.2 common/Frame#transparent.;
130 let palette: &[u8] = current_frame
131 .paletterust-analyzer cargo gif 0.14.2 common/Frame#palette.
132 .as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().()
133 .orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or().(self.global_paletterust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#global_palette..as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().())
134 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); // next_frame_info already checked it won't happen
135
136 let (pixels, rest) = buf.split_at_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at_mut().(bytes_decoded rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().N_CHANNELSrust-analyzer cargo gif 0.14.2 reader/converter/N_CHANNELS.);
137 buf = rest;
138
139 for (rgba, idx) in pixels
140 .chunks_exact_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_exact_mut().(N_CHANNELSrust-analyzer cargo gif 0.14.2 reader/converter/N_CHANNELS.)
141 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(self.bufferrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#buffer..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(bytes_decoded))
142 {
143 let plte_offset = PLTE_CHANNELSrust-analyzer cargo gif 0.14.2 reader/decoder/PLTE_CHANNELS. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().idx as usize;
144 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colors) =
145 palette.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(plte_offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#plte_offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().PLTE_CHANNELSrust-analyzer cargo gif 0.14.2 reader/decoder/PLTE_CHANNELS.)
146 {
147 rgba[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = colors[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
148 rgba[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = colors[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
149 rgba[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = colors[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
150 rgba[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(t) = transparent {
151 if t 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().idx {
152 0x00
153 } else {
154 0xFF
155 }
156 } else {
157 0xFF
158 };
159 }
160 }
161 }
162 ColorOutputrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#::Indexedrust-analyzer cargo gif 0.14.2 reader/converter/ColorOutput#Indexed# => {
163 buf = &mut buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().bytes_decoded..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().;
164 }
165 }
166 if buf.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
167 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true);
168 }
169 }
170 }
171 }
172 }
173
174 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn global_paletterust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]global_palette().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&[u8]> {
175 self.global_paletterust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#global_palette..as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().()
176 }
177
178 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn set_global_paletterust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]set_global_palette().(&mut self, palette: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) {
179 self.global_paletterust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#global_palette. = if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().palette.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
180 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(palette)
181 } else {
182 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
183 };
184 }
185
186 /// Applies deinterlacing
187 ///
188 /// Set `frame.interlaced = false` afterwards if you're putting the buffer back into the `Frame`
189 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn read_into_bufferrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]read_into_buffer().(
190 &mut self,
191 frame: &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>,
192 buf: &mut [u8],
193 data_callback: FillBufferCallbackrust-analyzer cargo gif 0.14.2 reader/converter/FillBufferCallback#<'_>,
194 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
195 if frame.interlacedrust-analyzer cargo gif 0.14.2 common/Frame#interlaced. {
196 let width = self.line_lengthrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]line_length().(frame);
197 for row in (InterlaceIteratorrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator# {
198 lenrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#len.: frame.heightrust-analyzer cargo gif 0.14.2 common/Frame#height.,
199 nextrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#next.: 0,
200 passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass.: 0,
201 }) {
202 // this can't overflow 32-bit, because row never equals (maximum) height
203 let start = row rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().width;
204 // Handle a too-small buffer and 32-bit usize overflow without panicking
205 let line = buf
206 .get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#)
207 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|b| b.get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#width))
208 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::formatrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]format().("buffer too small"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
209 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.fill_bufferrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]fill_buffer().(frame, line, data_callback)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
210 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::formatrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]format().("image truncated"));
211 }
212 }
213 } else {
214 let buf = self
215 .buffer_sizerust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]buffer_size().(frame)
216 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|buffer_size| buf.get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#buffer_size))
217 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::formatrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]format().("buffer too small"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
218 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.fill_bufferrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]fill_buffer().(frame, buf, data_callback)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
219 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::formatrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]format().("image truncated"));
220 }
221 };
222 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
223 }
224 }
225
226 struct InterlaceIteratorrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator# {
227 lenrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#len.: u16,
228 nextrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#next.: usize,
229 passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass.: usize,
230 }
231
232 impl iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for InterlaceIteratorrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator# {
233 type Itemrust-analyzer cargo gif 0.14.2 reader/converter/impl#[InterlaceIterator][Iterator]Item# = usize;
234
235 #[inline]
236 fn nextrust-analyzer cargo gif 0.14.2 reader/converter/impl#[InterlaceIterator][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo gif 0.14.2 reader/converter/impl#[InterlaceIterator][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
237 if self.lenrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#len. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0 {
238 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
239 }
240 // although the pass never goes out of bounds thanks to len==0,
241 // the optimizer doesn't see it. get()? avoids costlier panicking code.
242 let mut next = self.nextrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#next. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().[8, 8, 4, 2].getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(self.passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
243 while next 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().self.lenrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#len. as usize {
244 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(self.passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass. <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). 4);
245 next = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().[4, 2, 1, 0].getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(self.passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
246 self.passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass. 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;
247 }
248 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::swaprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/swap().(&mut next, &mut self.nextrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#next.);
249 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next)
250 }
251 }
252
253 #[cfg(test)]
254 mod testrust-analyzer cargo gif 0.14.2 reader/converter/test/ {
255 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#;
256
257 use superrust-analyzer cargo gif 0.14.2 reader/converter/::InterlaceIteratorrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#;
258
259 #[rustfmt::skip]
260 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
261 fn test_interlace_iteratorrust-analyzer cargo gif 0.14.2 reader/converter/test/test_interlace_iterator().() {
262 for &(len, expect) in &[
263 (0, &[][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
264 (1, &[0][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
265 (2, &[0, 1][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
266 (3, &[0, 2, 1][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
267 (4, &[0, 2, 1, 3][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
268 (5, &[0, 4, 2, 1, 3][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
269 (6, &[0, 4, 2, 1, 3, 5][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
270 (7, &[0, 4, 2, 6, 1, 3, 5][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
271 (8, &[0, 4, 2, 6, 1, 3, 5, 7][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
272 (9, &[0, 8, 4, 2, 6, 1, 3, 5, 7][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
273 (10, &[0, 8, 4, 2, 6, 1, 3, 5, 7, 9][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
274 (11, &[0, 8, 4, 2, 6, 10, 1, 3, 5, 7, 9][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
275 (12, &[0, 8, 4, 2, 6, 10, 1, 3, 5, 7, 9, 11][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
276 (13, &[0, 8, 4, 12, 2, 6, 10, 1, 3, 5, 7, 9, 11][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
277 (14, &[0, 8, 4, 12, 2, 6, 10, 1, 3, 5, 7, 9, 11, 13][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
278 (15, &[0, 8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
279 (16, &[0, 8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
280 (17, &[0, 8, 16, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().),
281 ] {
282 let iter = InterlaceIteratorrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator# { lenrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#len., nextrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#next.: 0, passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass.: 0 };
283 let lines = iter.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>();
284 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines, expect);
285 }
286 }
287
288 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
289 fn interlace_maxrust-analyzer cargo gif 0.14.2 reader/converter/test/interlace_max().() {
290 let iter = InterlaceIteratorrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator# {
291 lenrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#len.: 0xFFFF,
292 nextrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#next.: 0,
293 passrust-analyzer cargo gif 0.14.2 reader/converter/InterlaceIterator#pass.: 0,
294 };
295 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(65533, iter.lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#last().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().());
296 }
297 }