Debian Codegraph @

src/reader/decoder.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/::boxedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/::Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#;
3 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/;
4 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#;
5 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/;
6 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/::Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#;
7 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/;
8 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#;
9
10 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/;
11 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/;
12
13 use craterust-analyzer cargo gif 0.14.2 crate/::commonrust-analyzer cargo gif 0.14.2 common/::{AnyExtensionrust-analyzer cargo gif 0.14.2 common/AnyExtension#, Blockrust-analyzer cargo gif 0.14.2 common/Block#, DisposalMethodrust-analyzer cargo gif 0.14.2 common/DisposalMethod#, Extensionrust-analyzer cargo gif 0.14.2 common/Extension#, Framerust-analyzer cargo gif 0.14.2 common/Frame#};
14 use craterust-analyzer cargo gif 0.14.2 crate/::readerrust-analyzer cargo gif 0.14.2 reader/::DecodeOptionsrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#;
15 use craterust-analyzer cargo gif 0.14.2 crate/::MemoryLimitrust-analyzer cargo gif 0.14.2 reader/MemoryLimit#;
16
17 use weezlrust-analyzer cargo weezl 0.1.10 crate/::{decoderust-analyzer cargo weezl 0.1.10 decode/::Decoderrust-analyzer cargo weezl 0.1.10 decode/Decoder# as LzwDecoderrust-analyzer cargo weezl 0.1.10 decode/Decoder#, BitOrderrust-analyzer cargo weezl 0.1.10 BitOrder#, LzwErrorrust-analyzer cargo weezl 0.1.10 error/LzwError#, LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#};
18
19 /// GIF palettes are RGB
20 pub const PLTE_CHANNELSrust-analyzer cargo gif 0.14.2 reader/decoder/PLTE_CHANNELS.: usize = 3;
21
22 /// An error returned in the case of the image not being formatted properly.
23 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
24 pub struct DecodingFormatErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError# {
25 underlyingrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError#underlying.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + 'static>,
26 }
27
28 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for DecodingFormatErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError# {
29 #[cold]
30 fn fmtrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingFormatError][Display]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
31 fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#fmt().(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().self.underlyingrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError#underlying., fmt)
32 }
33 }
34
35 impl errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for DecodingFormatErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError# {
36 #[cold]
37 fn sourcerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingFormatError][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
38 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().self.underlyingrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError#underlying. as _)
39 }
40 }
41
42 /// Decoding error.
43 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
44 #[non_exhaustive]
45 pub enum DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError# {
46 /// Failed to internally allocate a buffer of sufficient size.
47 OutOfMemoryrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#OutOfMemory#,
48 /// Allocation exceeded set memory limit
49 MemoryLimitrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#MemoryLimit#,
50 /// Expected a decoder but none found.
51 DecoderNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#DecoderNotFound#,
52 /// Expected an end-code, but none found.
53 EndCodeNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#EndCodeNotFound#,
54 /// Decoding could not complete as the reader completed prematurely.
55 UnexpectedEofrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#UnexpectedEof#,
56 /// Error encountered while decoding an LZW stream.
57 LzwErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#LzwError#(LzwErrorrust-analyzer cargo weezl 0.1.10 error/LzwError#),
58 /// Returned if the image is found to be malformed.
59 Formatrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Format#(DecodingFormatErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError#),
60 /// Wraps `std::io::Error`.
61 Iorust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Io#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#),
62 }
63
64 impl DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError# {
65 #[cold]
66 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn formatrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]format().(err: &'static str) -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError] {
67 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]::Formatrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Format#(DecodingFormatErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError# {
68 underlyingrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError#underlying.: err.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
69 })
70 }
71 }
72
73 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError# {
74 #[cold]
75 fn fmtrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
76 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
77 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::OutOfMemoryrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#OutOfMemory# => fmt.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Out of Memory"),
78 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::MemoryLimitrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#MemoryLimit# => fmt.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Memory limit reached"),
79 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::DecoderNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#DecoderNotFound# => fmt.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Decoder Not Found"),
80 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::EndCodeNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#EndCodeNotFound# => fmt.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("End-Code Not Found"),
81 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::UnexpectedEofrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#UnexpectedEof# => fmt.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Unexpected End of File"),
82 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::LzwErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#LzwError#(ref err) => err.fmtrust-analyzer cargo weezl 0.1.10 error/impl#[LzwError][Display]fmt().(fmt),
83 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::Formatrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Format#(ref d) => d.fmtrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingFormatError][Display]fmt().(fmt),
84 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Display]::Iorust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Io#(ref err) => err.fmtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error][Display]fmt().(fmt),
85 }
86 }
87 }
88
89 impl errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError# {
90 #[cold]
91 fn sourcerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
92 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
93 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::OutOfMemoryrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#OutOfMemory# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
94 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::MemoryLimitrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#MemoryLimit# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
95 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::DecoderNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#DecoderNotFound# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
96 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::EndCodeNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#EndCodeNotFound# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
97 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::UnexpectedEofrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#UnexpectedEof# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
98 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::LzwErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#LzwError#(ref err) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(err),
99 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::Formatrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Format#(ref err) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(err),
100 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][Error]::Iorust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Io#(ref err) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(err),
101 }
102 }
103 }
104
105 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<LzwErrorrust-analyzer cargo weezl 0.1.10 error/LzwError#> for DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError# {
106 #[inline]
107 fn fromrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<LzwError>`]from().(err: LzwErrorrust-analyzer cargo weezl 0.1.10 error/LzwError#) -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<LzwError>`] {
108 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<LzwError>`]::LzwErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#LzwError#(err)
109 }
110 }
111
112 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> for DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError# {
113 #[inline]
114 fn fromrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<io::Error>`]from().(err: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<io::Error>`] {
115 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<io::Error>`]::Iorust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Io#(err)
116 }
117 }
118
119 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<DecodingFormatErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError#> for DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError# {
120 #[inline]
121 fn fromrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<DecodingFormatError>`]from().(err: DecodingFormatErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingFormatError#) -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<DecodingFormatError>`] {
122 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError][`From<DecodingFormatError>`]::Formatrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#Format#(err)
123 }
124 }
125
126 /// Varies depending on `skip_frame_decoding`
127 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:)]
128 pub enum FrameDataTyperust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType# {
129 /// `Frame.buffer` will be regular pixel data
130 Pixelsrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#Pixels#,
131 /// Raw LZW data
132 Lzwrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#Lzw# {
133 /// Needed for decoding
134 min_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#Lzw#min_code_size.: u8,
135 },
136 }
137
138 /// Indicates whether a certain object has been decoded
139 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
140 #[non_exhaustive]
141 pub enum Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded# {
142 /// Decoded nothing.
143 Nothingrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#Nothing#,
144 /// Global palette.
145 GlobalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#GlobalPalette#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<[u8]>),
146 /// Index of the background color in the global palette.
147 BackgroundColorrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BackgroundColor#(u8),
148 /// Palette and optional `Application` extension have been parsed,
149 /// reached frame data.
150 HeaderEndrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#HeaderEnd#,
151 /// The start of a block.
152 /// `BlockStart(Block::Trailer)` is the very last decode event
153 BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BlockStart#(Blockrust-analyzer cargo gif 0.14.2 common/Block#),
154 /// Decoded a sub-block.
155 ///
156 /// Call `last_ext_sub_block()` to get the sub-block data. It won't be available after this event.
157 SubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock# {
158 /// An ext label of `0` is used when the sub block does not belong to an extension.
159 extrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#ext.: AnyExtensionrust-analyzer cargo gif 0.14.2 common/AnyExtension#,
160 /// if true, then no more sub-blocks are available in this block.
161 is_lastrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#is_last.: bool,
162 },
163 /// Decoded all information of the next frame, except the image data.
164 ///
165 /// The returned frame does **not** contain any owned image data.
166 ///
167 /// Call `current_frame_mut()` to access the frame info.
168 FrameMetadatarust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#FrameMetadata#(FrameDataTyperust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#),
169 /// Decoded some data of the current frame. Size is in bytes, always > 0
170 BytesDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BytesDecoded#(NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#),
171 /// Copied (or consumed and discarded) compressed data of the current frame. In bytes.
172 LzwDataCopiedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#LzwDataCopied#(usize),
173 /// No more data available the current frame.
174 DataEndrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#DataEnd#,
175 }
176
177 /// Internal state of the GIF decoder
178 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:)]
179 enum Staterust-analyzer cargo gif 0.14.2 reader/decoder/State# {
180 Magicrust-analyzer cargo gif 0.14.2 reader/decoder/State#Magic#,
181 ScreenDescriptorrust-analyzer cargo gif 0.14.2 reader/decoder/State#ScreenDescriptor#,
182 ImageBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ImageBlockStart#,
183 GlobalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#GlobalPalette#(usize),
184 BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockStart#(u8),
185 BlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockEnd#,
186 ExtensionBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockStart#,
187 /// Resets ext.data
188 ExtensionDataSubBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlockStart#(usize),
189 /// Collects data in ext.data
190 ExtensionDataSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlock#(usize),
191 ExtensionBlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockEnd#,
192 LocalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#LocalPalette#(usize),
193 LzwInitrust-analyzer cargo gif 0.14.2 reader/decoder/State#LzwInit#(u8),
194 /// Decompresses LZW
195 DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(usize),
196 /// Keeps LZW compressed
197 CopySubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#CopySubBlock#(usize),
198 FrameDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/State#FrameDecoded#,
199 Trailerrust-analyzer cargo gif 0.14.2 reader/decoder/State#Trailer#,
200 }
201 use selfrust-analyzer cargo gif 0.14.2 reader/decoder/::Staterust-analyzer cargo gif 0.14.2 reader/decoder/State#::*;
202
203 use superrust-analyzer cargo gif 0.14.2 reader/::converterrust-analyzer cargo gif 0.14.2 reader/converter/::PixelConverterrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#;
204
205 /// Decoder for `Frame::make_lzw_pre_encoded`
206 pub struct FrameDecoderrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder# {
207 lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#lzw_reader.: LzwReaderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#,
208 pixel_converterrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#pixel_converter.: PixelConverterrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#,
209 memory_limitrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#memory_limit.: MemoryLimitrust-analyzer cargo gif 0.14.2 reader/MemoryLimit#,
210 }
211
212 impl FrameDecoderrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder# {
213 /// See also `set_global_palette`
214 #[inline]
215 #[must_use]
216 pub fn newrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder]new().(options: DecodeOptionsrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#) -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder] {
217 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder] {
218 lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#lzw_reader.: LzwReaderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#::newrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]new().(options.check_for_end_coderust-analyzer cargo gif 0.14.2 reader/DecodeOptions#check_for_end_code.),
219 pixel_converterrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#pixel_converter.: PixelConverterrust-analyzer cargo gif 0.14.2 reader/converter/PixelConverter#::newrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]new().(options.color_outputrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#color_output.),
220 memory_limitrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#memory_limit.: options.memory_limitrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#memory_limit..clonerust-analyzer cargo gif 0.14.2 reader/impl#[MemoryLimit][Clone]clone().(),
221 }
222 }
223
224 /// Palette used for RGBA conversion
225 #[inline]
226 pub fn set_global_paletterust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder]set_global_palette().(&mut self, palette: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) {
227 self.pixel_converterrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#pixel_converter..set_global_paletterust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]set_global_palette().(palette);
228 }
229
230 /// Converts the frame in-place, replacing its LZW buffer with pixels.
231 ///
232 /// If you get an error about invalid min code size, the buffer was probably pixels, not compressed data.
233 #[inline]
234 pub fn decode_lzw_encoded_framerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder]decode_lzw_encoded_frame().(&mut self, frame: &mut Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
235 let pixel_bytes = self
236 .pixel_converterrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#pixel_converter.
237 .check_buffer_sizerust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]check_buffer_size().(frame, &self.memory_limitrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#memory_limit.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
238 let mut vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; pixel_bytes];
239 self.decode_lzw_encoded_frame_into_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder]decode_lzw_encoded_frame_into_buffer().(frame, &mut vec)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
240 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);
241 frame.interlacedrust-analyzer cargo gif 0.14.2 common/Frame#interlaced. = false;
242 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
243 }
244
245 /// Converts into the given buffer. It must be [`buffer_size()`] bytes large.
246 ///
247 /// Pixels are always deinterlaced, so update `frame.interlaced` afterwards if you're putting the buffer back into the frame.
248 pub fn decode_lzw_encoded_frame_into_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder]decode_lzw_encoded_frame_into_buffer().(
249 &mut self,
250 frame: &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>,
251 buf: &mut [u8],
252 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
253 let (&min_code_size, mut data) = frame.bufferrust-analyzer cargo gif 0.14.2 common/Frame#buffer..split_firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_first().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().((&2, &[]));
254 self.lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#lzw_reader..resetrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]reset().(min_code_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
255 let lzw_reader = &mut self.lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#lzw_reader.;
256 self.pixel_converterrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#pixel_converter.
257 .read_into_bufferrust-analyzer cargo gif 0.14.2 reader/converter/impl#[PixelConverter]read_into_buffer().(frame, buf, &mut move |out| loop {
258 let (bytes_read, bytes_written, status) = lzw_reader.decode_bytesrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]decode_bytes().(data, out)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
259 data = data.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(bytes_read..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#).unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().();
260 if bytes_written rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 || matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(status, LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#::NoProgressrust-analyzer cargo weezl 0.1.10 error/LzwStatus#NoProgress#) {
261 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bytes_written);
262 }
263 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
264 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
265 }
266
267 /// Number of bytes required for `decode_lzw_encoded_frame_into_buffer`
268 #[inline]
269 #[must_use]
270 pub fn buffer_sizerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[FrameDecoder]buffer_size().(&self, frame: &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'_>) -> usize {
271 self.pixel_converterrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDecoder#pixel_converter..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().()
272 }
273 }
274
275 struct LzwReaderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader# {
276 decoderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#decoder.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<LzwDecoderrust-analyzer cargo weezl 0.1.10 decode/Decoder#>,
277 min_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#min_code_size.: u8,
278 check_for_end_coderust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#check_for_end_code.: bool,
279 }
280
281 impl LzwReaderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader# {
282 pub fn newrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]new().(check_for_end_code: bool) -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader] {
283 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader] {
284 decoderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#decoder.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
285 min_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#min_code_size.: 0,
286 check_for_end_coderust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#check_for_end_code.,
287 }
288 }
289
290 pub fn check_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]check_code_size().(min_code_size: u8) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
291 // LZW spec: max 12 bits per code. This check helps catch confusion
292 // between LZW-compressed buffers and raw pixel data
293 if min_code_size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().11 || min_code_size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().1 {
294 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().("invalid minimal code size"));
295 }
296 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
297 }
298
299 pub fn resetrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]reset().(&mut self, min_code_size: u8) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
300 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]::check_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]check_code_size().(min_code_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
301
302 // The decoder can be reused if the code size stayed the same
303 if self.min_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#min_code_size. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().min_code_size || self.decoderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#decoder..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() {
304 self.min_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#min_code_size. = min_code_size;
305 self.decoderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#decoder. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(LzwDecoderrust-analyzer cargo weezl 0.1.10 decode/Decoder#::newrust-analyzer cargo weezl 0.1.10 decode/impl#[Decoder]new().(BitOrderrust-analyzer cargo weezl 0.1.10 BitOrder#::Lsbrust-analyzer cargo weezl 0.1.10 BitOrder#Lsb#, min_code_size));
306 } else {
307 self.decoderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#decoder.
308 .as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().()
309 .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().("bad state"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
310 .resetrust-analyzer cargo weezl 0.1.10 decode/impl#[Decoder]reset().();
311 }
312
313 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
314 }
315
316 pub fn has_endedrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]has_ended().(&self) -> bool {
317 self.decoderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#decoder..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(true, |e| e.has_endedrust-analyzer cargo weezl 0.1.10 decode/impl#[Decoder]has_ended().())
318 }
319
320 pub fn decode_bytesrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]decode_bytes().(
321 &mut self,
322 lzw_data: &[u8],
323 decode_buffer: &mut OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#<'_>,
324 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(usize, usize, LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
325 let decoder = self
326 .decoderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#decoder.
327 .as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().()
328 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::DecoderNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#DecoderNotFound#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
329
330 let (status, consumed_in, consumed_out) = match decode_buffer {
331 OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Slicerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#Slice#(buf) => {
332 let decoded = decoder.decode_bytesrust-analyzer cargo weezl 0.1.10 decode/impl#[Decoder]decode_bytes().(lzw_data, buf);
333 (decoded.statusrust-analyzer cargo weezl 0.1.10 error/BufferResult#status., decoded.consumed_inrust-analyzer cargo weezl 0.1.10 error/BufferResult#consumed_in., decoded.consumed_outrust-analyzer cargo weezl 0.1.10 error/BufferResult#consumed_out.)
334 }
335 OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Nonerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#None# => {
336 let decoded = decoder.decode_bytesrust-analyzer cargo weezl 0.1.10 decode/impl#[Decoder]decode_bytes().(lzw_data, &mut []);
337 (decoded.statusrust-analyzer cargo weezl 0.1.10 error/BufferResult#status., decoded.consumed_inrust-analyzer cargo weezl 0.1.10 error/BufferResult#consumed_in., decoded.consumed_outrust-analyzer cargo weezl 0.1.10 error/BufferResult#consumed_out.)
338 }
339 OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Vecrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#Vec#(buf) => {
340 let decoded = decoder.into_vecrust-analyzer cargo weezl 0.1.10 decode/impl#[Decoder]into_vec().(buf).decoderust-analyzer cargo weezl 0.1.10 decode/impl#[`IntoVec<'_>`]decode().(lzw_data);
341 (decoded.statusrust-analyzer cargo weezl 0.1.10 error/VectorResult#status., decoded.consumed_inrust-analyzer cargo weezl 0.1.10 error/VectorResult#consumed_in., decoded.consumed_outrust-analyzer cargo weezl 0.1.10 error/VectorResult#consumed_out.)
342 }
343 };
344
345 let status = match status?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
346 ok @ LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#::Donerust-analyzer cargo weezl 0.1.10 error/LzwStatus#Done# | ok @ LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#::Okrust-analyzer cargo weezl 0.1.10 error/LzwStatus#Ok# => ok,
347 ok @ LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#::NoProgressrust-analyzer cargo weezl 0.1.10 error/LzwStatus#NoProgress# => {
348 if self.check_for_end_coderust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#check_for_end_code. {
349 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#::EndCodeNotFoundrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#EndCodeNotFound#);
350 }
351
352 ok
353 }
354 };
355
356 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((consumed_in, consumed_out, status))
357 }
358 }
359
360 /// GIF decoder which emits [low-level events](Decoded) for items in the GIF file
361 ///
362 /// To just get GIF frames, use [`crate::Decoder`] instead.
363 pub struct StreamingDecoderrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder# {
364 staterust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#state.: Staterust-analyzer cargo gif 0.14.2 reader/decoder/State#,
365 /// Input bytes are collected here if `update` got `buf` smaller than the minimum required
366 internal_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#internal_buffer.: [u8; 9],
367 unused_internal_buffer_lenrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#unused_internal_buffer_len.: u8,
368 lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#lzw_reader.: LzwReaderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#,
369 skip_frame_decodingrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#skip_frame_decoding.: bool,
370 check_frame_consistencyrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#check_frame_consistency.: bool,
371 allow_unknown_blocksrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#allow_unknown_blocks.: bool,
372 memory_limitrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#memory_limit.: MemoryLimitrust-analyzer cargo gif 0.14.2 reader/MemoryLimit#,
373 versionrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#version.: Versionrust-analyzer cargo gif 0.14.2 reader/decoder/Version#,
374 widthrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#width.: u16,
375 heightrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#height.: u16,
376 global_color_tablerust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#global_color_table.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>,
377 /// ext buffer
378 extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext.: ExtensionDatarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#,
379 /// Frame data
380 currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Framerust-analyzer cargo gif 0.14.2 common/Frame#<'static>>,
381 /// Needs to emit `HeaderEnd` once
382 header_end_reachedrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#header_end_reached.: bool,
383 }
384
385 /// One version number of the GIF standard.
386 #[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:, 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:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
387 pub enum Versionrust-analyzer cargo gif 0.14.2 reader/decoder/Version# {
388 /// Version 87a, from May 1987.
389 V87arust-analyzer cargo gif 0.14.2 reader/decoder/Version#V87a#,
390 /// Version 89a, from July 1989.
391 V89arust-analyzer cargo gif 0.14.2 reader/decoder/Version#V89a#,
392 }
393
394 struct ExtensionDatarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData# {
395 idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id.: AnyExtensionrust-analyzer cargo gif 0.14.2 common/AnyExtension#,
396 datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>,
397 }
398
399 /// Destination to write to for `StreamingDecoder::update`
400 pub enum OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#<'a> {
401 /// Overwrite bytes
402 Slicerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#Slice#(&'a mut [u8]),
403 /// Append LZW bytes
404 Vecrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#Vec#(&'a mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>),
405 /// Discard bytes
406 Nonerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#None#,
407 }
408
409 impl OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#<'_> {
410 fn appendrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[`OutputBuffer<'_>`]append().(
411 &mut self,
412 buf: &[u8],
413 memory_limit: &MemoryLimitrust-analyzer cargo gif 0.14.2 reader/MemoryLimit#,
414 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(usize, usize), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
415 let (consumed, copied) = match self {
416 OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Slicerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#Slice#(slice) => {
417 let len = cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), slice.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
418 slice[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/RangeTo#len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()..copy_from_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]copy_from_slice().(&buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
419 (len, len)
420 }
421 OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Vecrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#Vec#(vec) => {
422 let vec: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vec;
423 let len = buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
424 memory_limit.try_reserverust-analyzer cargo gif 0.14.2 reader/impl#[MemoryLimit]try_reserve().(vec, len)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
425 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 ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().vec.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>`]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().len {
426 vec.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(buf);
427 }
428 (len, len)
429 }
430 // It's valid that bytes are discarded. For example,
431 // when using next_frame_info() with skip_frame_decoding to only get metadata.
432 OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Nonerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#None# => (buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), 0),
433 };
434 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((consumed, copied))
435 }
436 }
437
438 impl StreamingDecoderrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder# {
439 /// Creates a new streaming decoder
440 #[must_use]
441 pub fn newrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]new().() -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder] {
442 let options = DecodeOptionsrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#::newrust-analyzer cargo gif 0.14.2 reader/impl#[DecodeOptions]new().();
443 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]::with_optionsrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]with_options().(&options)
444 }
445
446 pub(craterust-analyzer cargo gif 0.14.2 crate/) fn with_optionsrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]with_options().(options: &DecodeOptionsrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#) -> Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder] {
447 Selfrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder] {
448 internal_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#internal_buffer.: [0; 9],
449 unused_internal_buffer_lenrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#unused_internal_buffer_len.: 0,
450 staterust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#state.: Magicrust-analyzer cargo gif 0.14.2 reader/decoder/State#Magic#,
451 lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#lzw_reader.: LzwReaderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#::newrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]new().(options.check_for_end_coderust-analyzer cargo gif 0.14.2 reader/DecodeOptions#check_for_end_code.),
452 skip_frame_decodingrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#skip_frame_decoding.: options.skip_frame_decodingrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#skip_frame_decoding.,
453 check_frame_consistencyrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#check_frame_consistency.: options.check_frame_consistencyrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#check_frame_consistency.,
454 allow_unknown_blocksrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#allow_unknown_blocks.: options.allow_unknown_blocksrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#allow_unknown_blocks.,
455 memory_limitrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#memory_limit.: options.memory_limitrust-analyzer cargo gif 0.14.2 reader/DecodeOptions#memory_limit..clonerust-analyzer cargo gif 0.14.2 reader/impl#[MemoryLimit][Clone]clone().(),
456 versionrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#version.: Versionrust-analyzer cargo gif 0.14.2 reader/decoder/Version#::V87arust-analyzer cargo gif 0.14.2 reader/decoder/Version#V87a#,
457 widthrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#width.: 0,
458 heightrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#height.: 0,
459 global_color_tablerust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#global_color_table.: 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().(),
460 extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext.: ExtensionDatarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData# {
461 idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id.: AnyExtensionrust-analyzer cargo gif 0.14.2 common/AnyExtension#(0),
462 datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(256), // 0xFF + 1 byte length
463 },
464 currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
465 header_end_reachedrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#header_end_reached.: false,
466 }
467 }
468
469 /// Updates the internal state of the decoder.
470 ///
471 /// Returns the number of bytes consumed from the input buffer
472 /// and the last decoding result.
473 pub fn updaterust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]update().(
474 &mut self,
475 mut buf: &[u8],
476 write_into: &mut OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#<'_>,
477 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(usize, Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
478 let len = buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
479 while !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().buf.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
480 let (bytes, decoded) = self.next_staterust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]next_state().(buf, write_into)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
481 buf = buf.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(bytes..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#).unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().();
482 match decoded {
483 Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::Nothingrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#Nothing# => {}
484 result => {
485 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), result));
486 }
487 };
488 }
489 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::Nothingrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#Nothing#))
490 }
491
492 /// Data of the last extension sub block that has been decoded.
493 /// You need to concatenate all subblocks together to get the overall block content.
494 #[must_use]
495 pub fn last_ext_sub_blockrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]last_ext_sub_block().(&mut self) -> &[u8] {
496 &self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data.
497 }
498
499 /// Current frame info as a mutable ref.
500 #[must_use]
501 #[track_caller]
502 pub fn current_frame_mutrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]current_frame_mut().(&mut self) -> &mut Framerust-analyzer cargo gif 0.14.2 common/Frame#<'static> {
503 self.currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current..as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
504 }
505
506 /// Current frame info as a ref.
507 #[track_caller]
508 #[must_use]
509 pub fn current_framerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]current_frame().(&self) -> &Framerust-analyzer cargo gif 0.14.2 common/Frame#<'static> {
510 self.currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
511 }
512
513 /// Current frame info as a mutable ref.
514 #[inline(always)]
515 fn try_current_framerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]try_current_frame().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&mut Framerust-analyzer cargo gif 0.14.2 common/Frame#<'static>, DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
516 self.currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current.
517 .as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().()
518 .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().("bad state"))
519 }
520
521 /// Width of the image
522 #[must_use]
523 pub fn widthrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]width().(&self) -> u16 {
524 self.widthrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#width.
525 }
526
527 /// Height of the image
528 #[must_use]
529 pub fn heightrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]height().(&self) -> u16 {
530 self.heightrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#height.
531 }
532
533 /// The version number of the GIF standard used in this image.
534 ///
535 /// We suppose a minimum of `V87a` compatibility. This value will be reported until we have
536 /// read the version information in the magic header bytes.
537 #[must_use]
538 pub fn versionrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]version().(&self) -> Versionrust-analyzer cargo gif 0.14.2 reader/decoder/Version# {
539 self.versionrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#version.
540 }
541
542 #[inline]
543 fn next_staterust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]next_state().(
544 &mut self,
545 buf: &[u8],
546 write_into: &mut OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#<'_>,
547 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(usize, Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
548 macro_rules! gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto! (
549 ($n:expr, $state:expr) => ({
550 self.state = $state;
551 Ok(($n, Decoded::Nothing))
552 });
553 ($state:expr) => ({
554 self.state = $state;
555 Ok((1, Decoded::Nothing))
556 });
557 ($n:expr, $state:expr, emit $res:expr) => ({
558 self.state = $state;
559 Ok(($n, $res))
560 });
561 ($state:expr, emit $res:expr) => ({
562 self.state = $state;
563 Ok((1, $res))
564 })
565 );
566
567 macro_rules! ensure_min_length_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/ensure_min_length_buffer! (
568 ($required:expr) => ({
569 let required: usize = $required;
570 if buf.len() >= required && self.unused_internal_buffer_len == 0 {
571 (required, &buf[..required])
572 } else {
573 let has = usize::from(self.unused_internal_buffer_len);
574 let mut consumed = 0;
575 if has < required {
576 let to_copy = buf.len().min(required - has);
577 let new_len = has + to_copy;
578 self.internal_buffer[has .. new_len].copy_from_slice(&buf[..to_copy]);
579 consumed += to_copy;
580 if new_len < required {
581 self.unused_internal_buffer_len = new_len as u8;
582 return Ok((consumed, Decoded::Nothing));
583 } else {
584 self.unused_internal_buffer_len = 0;
585 }
586 }
587 (consumed, &self.internal_buffer[..required])
588 }
589 })
590 );
591
592 let b = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().buf.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().().ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::UnexpectedEofrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#UnexpectedEof#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
593
594 match self.staterust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#state. {
595 Magicrust-analyzer cargo gif 0.14.2 reader/decoder/State#Magic# => {
596 let (consumed, version) = ensure_min_length_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/ensure_min_length_buffer!!(6);
597
598 self.versionrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#version. = match version {
599 b"GIF87a" => Versionrust-analyzer cargo gif 0.14.2 reader/decoder/Version#::V87arust-analyzer cargo gif 0.14.2 reader/decoder/Version#V87a#,
600 b"GIF89a" => Versionrust-analyzer cargo gif 0.14.2 reader/decoder/Version#::V89arust-analyzer cargo gif 0.14.2 reader/decoder/Version#V89a#,
601 _ => 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().("malformed GIF header")),
602 };
603
604 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(consumed, ScreenDescriptorrust-analyzer cargo gif 0.14.2 reader/decoder/State#ScreenDescriptor#)
605 }
606 ScreenDescriptorrust-analyzer cargo gif 0.14.2 reader/decoder/State#ScreenDescriptor# => {
607 let (consumed, desc) = ensure_min_length_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/ensure_min_length_buffer!!(7);
608
609 self.widthrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#width. = u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(desc[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
610 self.heightrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#height. = u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(desc[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/range/Range#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
611 let global_flags = desc[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
612 let background_color = desc[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
613
614 let global_table = global_flags 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().0x80 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0;
615 let table_size = if global_table {
616 let table_size = 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().(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<Self>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<Self>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<Self>`]shl().((global_flags 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().0b111) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().1) as usize);
617 self.global_color_tablerust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#global_color_table.
618 .try_reserve_exactrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]try_reserve_exact().(table_size)
619 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| 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().;
620 table_size
621 } else {
622 0usize
623 };
624
625 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(
626 consumed,
627 GlobalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#GlobalPalette#(table_size),
628 emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::BackgroundColorrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BackgroundColor#(background_color)
629 )
630 }
631 ImageBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ImageBlockStart# => {
632 let (consumed, header) = ensure_min_length_bufferrust-analyzer cargo gif 0.14.2 reader/decoder/ensure_min_length_buffer!!(9);
633
634 let frame = self
635 .currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current.
636 .as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().()
637 .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().("bad state"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
638 frame.leftrust-analyzer cargo gif 0.14.2 common/Frame#left. = u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(header[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
639 frame.toprust-analyzer cargo gif 0.14.2 common/Frame#top. = u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(header[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/range/Range#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
640 frame.widthrust-analyzer cargo gif 0.14.2 common/Frame#width. = u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(header[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().4..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
641 frame.heightrust-analyzer cargo gif 0.14.2 common/Frame#height. = u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(header[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().6..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
642
643 let flags = header[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
644 frame.interlacedrust-analyzer cargo gif 0.14.2 common/Frame#interlaced. = (flags 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().0b0100_0000) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0;
645
646 if self.check_frame_consistencyrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#check_frame_consistency. {
647 // Consistency checks.
648 if self.widthrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#width..checked_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]checked_sub().(frame.widthrust-analyzer cargo gif 0.14.2 common/Frame#width.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(frame.leftrust-analyzer cargo gif 0.14.2 common/Frame#left.)
649 || self.heightrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#height..checked_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]checked_sub().(frame.heightrust-analyzer cargo gif 0.14.2 common/Frame#height.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(frame.toprust-analyzer cargo gif 0.14.2 common/Frame#top.)
650 {
651 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().("frame descriptor is out-of-bounds"));
652 }
653 }
654
655 let local_table = (flags 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().0b1000_0000) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0;
656 if local_table {
657 let table_size = flags 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().0b0000_0111;
658 let pal_len = 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().(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<u8>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<u8>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<u8>`]shl().(table_size rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().1));
659 frame
660 .paletterust-analyzer cargo gif 0.14.2 common/Frame#palette.
661 .get_or_insert_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]get_or_insert_with().(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().)
662 .try_reserve_exactrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]try_reserve_exact().(pal_len)
663 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| 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().;
664 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(consumed, LocalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#LocalPalette#(pal_len))
665 } else {
666 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(consumed, LocalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#LocalPalette#(0))
667 }
668 }
669 GlobalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#GlobalPalette#(left) => {
670 // the global_color_table is guaranteed to have the exact capacity required
671 if left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
672 let n = cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(left, buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
673 if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().self.global_color_tablerust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#global_color_table..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 ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().self.global_color_tablerust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#global_color_table..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() {
674 self.global_color_tablerust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#global_color_table..extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
675 }
676 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(n, GlobalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#GlobalPalette#(left -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). n))
677 } else {
678 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockStart#(b), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::GlobalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#GlobalPalette#(
679 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut self.global_color_tablerust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#global_color_table.).into_boxed_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]into_boxed_slice().()
680 ))
681 }
682 }
683 BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockStart#(type_) => {
684 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.header_end_reachedrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#header_end_reached. && type_ rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().Blockrust-analyzer cargo gif 0.14.2 common/Block#::Extensionrust-analyzer cargo gif 0.14.2 common/Block#Extension# as u8 {
685 self.header_end_reachedrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#header_end_reached. = true;
686 return gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockStart#(type_), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::HeaderEndrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#HeaderEnd#);
687 }
688
689 match Blockrust-analyzer cargo gif 0.14.2 common/Block#::from_u8rust-analyzer cargo gif 0.14.2 common/impl#[Block]from_u8().(type_) {
690 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Blockrust-analyzer cargo gif 0.14.2 common/Block#::Imagerust-analyzer cargo gif 0.14.2 common/Block#Image#) => {
691 self.add_framerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]add_frame().();
692 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, ImageBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ImageBlockStart#, emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BlockStart#(Blockrust-analyzer cargo gif 0.14.2 common/Block#::Imagerust-analyzer cargo gif 0.14.2 common/Block#Image#))
693 }
694 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Blockrust-analyzer cargo gif 0.14.2 common/Block#::Extensionrust-analyzer cargo gif 0.14.2 common/Block#Extension#) => {
695 self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id. = AnyExtensionrust-analyzer cargo gif 0.14.2 common/AnyExtension#(b);
696 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.allow_unknown_blocksrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#allow_unknown_blocks. && self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id..into_knownrust-analyzer cargo gif 0.14.2 common/impl#[AnyExtension]into_known().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() {
697 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().(
698 "unknown extension block encountered",
699 ));
700 }
701 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(ExtensionBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockStart#)
702 }
703 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Blockrust-analyzer cargo gif 0.14.2 common/Block#::Trailerrust-analyzer cargo gif 0.14.2 common/Block#Trailer#) => {
704 // The `Trailer` is the final state, and isn't reachable without extraneous data after the end of file
705 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(Trailerrust-analyzer cargo gif 0.14.2 reader/decoder/State#Trailer#, emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BlockStart#(Blockrust-analyzer cargo gif 0.14.2 common/Block#::Trailerrust-analyzer cargo gif 0.14.2 common/Block#Trailer#))
706 }
707 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {
708 if self.allow_unknown_blocksrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#allow_unknown_blocks. {
709 self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id. = AnyExtensionrust-analyzer cargo gif 0.14.2 common/AnyExtension#(0);
710 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, ExtensionBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockStart#)
711 } else {
712 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().("unknown block type encountered"))
713 }
714 }
715 }
716 }
717 ExtensionBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockStart# => {
718 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(ExtensionDataSubBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlockStart#(b as usize), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BlockStart#(Blockrust-analyzer cargo gif 0.14.2 common/Block#::Extensionrust-analyzer cargo gif 0.14.2 common/Block#Extension#))
719 }
720 ExtensionBlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockEnd# => {
721 self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().();
722 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, BlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockEnd#)
723 }
724 BlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockEnd# => {
725 if b 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().Blockrust-analyzer cargo gif 0.14.2 common/Block#::Trailerrust-analyzer cargo gif 0.14.2 common/Block#Trailer# as u8 {
726 // can't consume yet, because the trailer is not a real block,
727 // and won't have futher data for BlockStart
728 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockStart#(b))
729 } else {
730 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(BlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockStart#(b))
731 }
732 }
733 ExtensionDataSubBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlockStart#(sub_block_len) => {
734 self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().();
735 if sub_block_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().0 {
736 // A zero-length sub-block is a block terminator (GIF89a spec §23).
737 // Short-circuit here rather than entering ExtensionDataSubBlock(0),
738 // which would re-present the next record byte and misparse it as a
739 // new sub-block length.
740 if self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id..into_knownrust-analyzer cargo gif 0.14.2 common/impl#[AnyExtension]into_known().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Extensionrust-analyzer cargo gif 0.14.2 common/Extension#::Controlrust-analyzer cargo gif 0.14.2 common/Extension#Control#) {
741 self.read_control_extensionrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]read_control_extension().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
742 }
743 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, ExtensionBlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockEnd#, emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::SubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock# { extrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#ext.: self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id., is_lastrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#is_last.: true })
744 } else {
745 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, ExtensionDataSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlock#(sub_block_len))
746 }
747 }
748 ExtensionDataSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlock#(left) => {
749 if left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
750 let n = cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(left, buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
751 let needs_to_grow =
752 n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data..capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]capacity().().wrapping_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]wrapping_sub().(self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().());
753 if needs_to_grow {
754 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#::OutOfMemoryrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#OutOfMemory#);
755 }
756 self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data..extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
757 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(n, ExtensionDataSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlock#(left -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). n))
758 } else if b 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().0 {
759 if self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id..into_knownrust-analyzer cargo gif 0.14.2 common/impl#[AnyExtension]into_known().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Extensionrust-analyzer cargo gif 0.14.2 common/Extension#::Controlrust-analyzer cargo gif 0.14.2 common/Extension#Control#) {
760 self.read_control_extensionrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]read_control_extension().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
761 }
762 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(ExtensionBlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionBlockEnd#, emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::SubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock# { extrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#ext.: self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id., is_lastrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#is_last.: true })
763 } else {
764 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(ExtensionDataSubBlockStartrust-analyzer cargo gif 0.14.2 reader/decoder/State#ExtensionDataSubBlockStart#(b as usize), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::SubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock# { extrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#ext.: self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..idrust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#id., is_lastrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#SubBlock#is_last.: false })
765 }
766 }
767 LocalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#LocalPalette#(left) => {
768 if left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
769 let n = cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(left, buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
770 let src = &buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
771 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pal) = self.try_current_framerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]try_current_frame().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..paletterust-analyzer cargo gif 0.14.2 common/Frame#palette..as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().() {
772 // capacity has already been reserved in ImageBlockStart
773 if pal.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 ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().pal.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>`]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().src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
774 pal.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(src);
775 }
776 }
777 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(n, LocalPaletterust-analyzer cargo gif 0.14.2 reader/decoder/State#LocalPalette#(left -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). n))
778 } else {
779 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(LzwInitrust-analyzer cargo gif 0.14.2 reader/decoder/State#LzwInit#(b))
780 }
781 }
782 LzwInitrust-analyzer cargo gif 0.14.2 reader/decoder/State#LzwInit#(min_code_size) => {
783 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.skip_frame_decodingrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#skip_frame_decoding. {
784 // Reset validates the min code size
785 self.lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#lzw_reader..resetrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]reset().(min_code_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
786 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(b as usize), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::FrameMetadatarust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#FrameMetadata#(FrameDataTyperust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#::Pixelsrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#Pixels#))
787 } else {
788 LzwReaderrust-analyzer cargo gif 0.14.2 reader/decoder/LzwReader#::check_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]check_code_size().(min_code_size)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
789 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(CopySubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#CopySubBlock#(b as usize), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::FrameMetadatarust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#FrameMetadata#(FrameDataTyperust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#::Lzwrust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#Lzw# { min_code_sizerust-analyzer cargo gif 0.14.2 reader/decoder/FrameDataType#Lzw#min_code_size. }))
790 }
791 }
792 CopySubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#CopySubBlock#(left) => {
793 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(self.skip_frame_decodingrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#skip_frame_decoding.);
794 if left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
795 let n = cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(left, buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
796 let (consumed, copied) = write_into.appendrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[`OutputBuffer<'_>`]append().(&buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., &self.memory_limitrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#memory_limit.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
797 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(consumed, CopySubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#CopySubBlock#(left -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). consumed), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::LzwDataCopiedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#LzwDataCopied#(copied))
798 } else if b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0 {
799 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(CopySubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#CopySubBlock#(b as usize))
800 } else {
801 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, FrameDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/State#FrameDecoded#)
802 }
803 }
804 DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(left) => {
805 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.skip_frame_decodingrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#skip_frame_decoding.);
806 if left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
807 let n = cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(left, buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
808 if self.lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#lzw_reader..has_endedrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]has_ended().() || matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(write_into, OutputBufferrust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#::Nonerust-analyzer cargo gif 0.14.2 reader/decoder/OutputBuffer#None#) {
809 return gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(n, DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(left -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). n), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::Nothingrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#Nothing#);
810 }
811
812 let (mut consumed, bytes_len, status) =
813 self.lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#lzw_reader..decode_bytesrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]decode_bytes().(&buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., write_into)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
814
815 // skip if can't make progress (decode would fail if check_for_end_code was set)
816 if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(status, LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#::NoProgressrust-analyzer cargo weezl 0.1.10 error/LzwStatus#NoProgress#) {
817 consumed = n;
818 }
819
820 let decoded = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(bytes_len) = NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(bytes_len) {
821 Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::BytesDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BytesDecoded#(bytes_len)
822 } else {
823 Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::Nothingrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#Nothing#
824 };
825 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(consumed, DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(left -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). consumed), emit decoded)
826 } else if b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0 {
827 // decode next sub-block
828 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(b as usize))
829 } else {
830 let (_, bytes_len, status) = self.lzw_readerrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#lzw_reader..decode_bytesrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[LzwReader]decode_bytes().(&[], write_into)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
831
832 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(bytes_len) = NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]new().(bytes_len) {
833 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(0), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::BytesDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#BytesDecoded#(bytes_len))
834 } else if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(status, LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#::Okrust-analyzer cargo weezl 0.1.10 error/LzwStatus#Ok#) {
835 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, DecodeSubBlockrust-analyzer cargo gif 0.14.2 reader/decoder/State#DecodeSubBlock#(0), emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::Nothingrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#Nothing#)
836 } else if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(status, LzwStatusrust-analyzer cargo weezl 0.1.10 error/LzwStatus#::Donerust-analyzer cargo weezl 0.1.10 error/LzwStatus#Done#) {
837 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, FrameDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/State#FrameDecoded#)
838 } else {
839 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, FrameDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/State#FrameDecoded#)
840 }
841 }
842 }
843 FrameDecodedrust-analyzer cargo gif 0.14.2 reader/decoder/State#FrameDecoded# => {
844 // end of image data reached
845 self.currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
846 debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(0, b);
847 gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(BlockEndrust-analyzer cargo gif 0.14.2 reader/decoder/State#BlockEnd#, emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::DataEndrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#DataEnd#)
848 }
849 Trailerrust-analyzer cargo gif 0.14.2 reader/decoder/State#Trailer# => gotorust-analyzer cargo gif 0.14.2 reader/decoder/goto!!(0, Trailerrust-analyzer cargo gif 0.14.2 reader/decoder/State#Trailer#, emit Decodedrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#::Nothingrust-analyzer cargo gif 0.14.2 reader/decoder/Decoded#Nothing#),
850 }
851 }
852
853 fn read_control_extensionrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]read_control_extension().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#> {
854 if self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data..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][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().4 {
855 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().("control extension has wrong length"));
856 }
857 let control = &self.extrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#ext..datarust-analyzer cargo gif 0.14.2 reader/decoder/ExtensionData#data.;
858
859 let frame = self.currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current..get_or_insert_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]get_or_insert_with().(Framerust-analyzer cargo gif 0.14.2 common/Frame#::defaultrust-analyzer cargo gif 0.14.2 common/impl#[`Frame<'_>`][Default]default().);
860 let control_flags = control[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().;
861 frame.needs_user_inputrust-analyzer cargo gif 0.14.2 common/Frame#needs_user_input. = control_flags 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().0b10 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0;
862 frame.disposerust-analyzer cargo gif 0.14.2 common/Frame#dispose. = match DisposalMethodrust-analyzer cargo gif 0.14.2 common/DisposalMethod#::from_u8rust-analyzer cargo gif 0.14.2 common/impl#[DisposalMethod]from_u8().((control_flags 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().0b11100) 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) {
863 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(method) => method,
864 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => DisposalMethodrust-analyzer cargo gif 0.14.2 common/DisposalMethod#::Anyrust-analyzer cargo gif 0.14.2 common/DisposalMethod#Any#,
865 };
866 frame.delayrust-analyzer cargo gif 0.14.2 common/Frame#delay. = u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(control[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/range/Range#3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
867 frame.transparentrust-analyzer cargo gif 0.14.2 common/Frame#transparent. = (control_flags 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().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0).then_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core bool/impl#[bool]then_some().(control[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
868 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
869 }
870
871 fn add_framerust-analyzer cargo gif 0.14.2 reader/decoder/impl#[StreamingDecoder]add_frame().(&mut self) {
872 if self.currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() {
873 self.currentrust-analyzer cargo gif 0.14.2 reader/decoder/StreamingDecoder#current. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Framerust-analyzer cargo gif 0.14.2 common/Frame#::defaultrust-analyzer cargo gif 0.14.2 common/impl#[`Frame<'_>`][Default]default().());
874 }
875 }
876 }
877
878 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
879 fn error_castrust-analyzer cargo gif 0.14.2 reader/decoder/error_cast().() {
880 let _: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#> = DecodingErrorrust-analyzer cargo gif 0.14.2 reader/decoder/DecodingError#::formatrust-analyzer cargo gif 0.14.2 reader/decoder/impl#[DecodingError]format().("testing").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().();
881 }