Debian Codegraph @

src/lz4f/stream/decomp/mod.rs

raw symbols SCIP
1 //! Streaming LZ4F decompressors.
2 mod bufreadrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/bufread/;
3 mod readrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/read/;
4 mod writerust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/write/;
5
6 pub use bufreadrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/bufread/::*;
7 pub use readrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/read/::*;
8 pub use writerust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/write/::*;
9
10 use craterust-analyzer cargo lzzzz 2.0.0 crate/::{
11 commonrust-analyzer cargo lzzzz 2.0.0 common/::DEFAULT_BUF_SIZErust-analyzer cargo lzzzz 2.0.0 common/DEFAULT_BUF_SIZE.,
12 lz4frust-analyzer cargo lzzzz 2.0.0 lz4f/::{
13 apirust-analyzer cargo lzzzz 2.0.0 lz4f/api/::{
14 header_sizerust-analyzer cargo lzzzz 2.0.0 lz4f/api/header_size()., DecompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#, LZ4F_HEADER_SIZE_MAXrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_HEADER_SIZE_MAX.,
15 LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTHrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH.,
16 },
17 FrameInforust-analyzer cargo lzzzz 2.0.0 lz4f/frame_info/FrameInfo#, Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#,
18 },
19 Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#, ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#,
20 };
21 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std 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#, cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/, pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/::Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#, ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/};
22
23 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
24 struct DictPtrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/DictPtr#(*const u8, usize);
25
26 #[allow(unsafe_code)]
27 unsafe impl Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# for DictPtrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/DictPtr# {}
28
29 enum Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State# {
30 Headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header# {
31 headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header.: [u8; LZ4F_HEADER_SIZE_MAXrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_HEADER_SIZE_MAX.],
32 header_lenrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header_len.: usize,
33 },
34 Bodyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body# {
35 frame_inforust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body#frame_info.: FrameInforust-analyzer cargo lzzzz 2.0.0 lz4f/frame_info/FrameInfo#,
36 comp_dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body#comp_dict.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DictPtrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/DictPtr#>,
37 },
38 }
39
40 pub(craterust-analyzer cargo lzzzz 2.0.0 crate/) struct Decompressorrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#<'a> {
41 ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#ctx.: DecompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#,
42 staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#state.: Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#,
43 bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>,
44 dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#dict.: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, [u8]>>,
45 header_onlyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#header_only.: bool,
46 }
47
48 impl<'a> Decompressorrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#<'a> {
49 pub fn newrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]new().() -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]> {
50 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`] {
51 ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#ctx.: DecompressionContextrust-analyzer cargo lzzzz 2.0.0 lz4f/api/DecompressionContext#::newrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]new().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
52 staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#state.: Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#::Headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header# {
53 headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header.: [0; LZ4F_HEADER_SIZE_MAXrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_HEADER_SIZE_MAX.],
54 header_lenrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header_len.: 0,
55 },
56 bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
57 dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#dict.: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/impl#[`Pin<Ptr>`]new().(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(&[])),
58 header_onlyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#header_only.: false,
59 })
60 }
61
62 pub fn set_dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]set_dict().<D>(&mut self, dict: D)
63 where
64 D: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, [u8]>>,
65 {
66 self.dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#dict. = Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/impl#[`Pin<Ptr>`]new().(dict.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().());
67 }
68
69 pub fn frame_inforust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]frame_info().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<FrameInforust-analyzer cargo lzzzz 2.0.0 lz4f/frame_info/FrameInfo#> {
70 if let Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#::Bodyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body# { frame_inforust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body#frame_info., .. } = self.staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#state. {
71 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(frame_info)
72 } else {
73 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
74 }
75 }
76
77 pub fn decode_header_onlyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]decode_header_only().(&mut self, flag: bool) {
78 self.header_onlyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#header_only. = flag;
79 }
80
81 pub fn decompressrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]decompress().(&mut self, src: &[u8]) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<usize> {
82 let mut header_consumed = 0;
83 if let Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#::Headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header# {
84 ref mut headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header.,
85 ref mut header_lenrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header_len.,
86 } = &mut self.staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#state.
87 {
88 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTHrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH. {
89 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().(LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTHrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH. 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().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len, src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
90 header[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/deref/impl#[`&mut T`][Deref]deref().header_len..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().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().(&src[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().);
91 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().len;
92 header_consumed rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().len;
93 }
94 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_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().LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTHrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH. {
95 let exact_header_len = header_sizerust-analyzer cargo lzzzz 2.0.0 lz4f/api/header_size().(&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#*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
96 if exact_header_len 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().LZ4F_HEADER_SIZE_MAXrust-analyzer cargo lzzzz 2.0.0 lz4f/api/LZ4F_HEADER_SIZE_MAX. {
97 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::FrameHeaderInvalidrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#FrameHeaderInvalid#).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
98 }
99 let src = &src[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().header_consumed..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
100 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().exact_header_len {
101 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().(exact_header_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().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len, src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
102 header[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/deref/impl#[`&mut T`][Deref]deref().header_len..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().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().(&src[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().);
103 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().len;
104 header_consumed rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().len;
105 }
106 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_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().exact_header_len {
107 let (frame, rep) = self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#ctx..get_frame_inforust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]get_frame_info().(&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#*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().header_len]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 result/impl#[`Result<T, E>`][Try]branch().;
108 header_consumed = 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().(header_consumed, rep);
109
110 self.staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#state. = Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#::Bodyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body# {
111 frame_inforust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body#frame_info.: frame,
112 comp_dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body#comp_dict.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
113 }
114 }
115 }
116 }
117
118 if let Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#::Headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header# { headerrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header., header_lenrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Header#header_len. } = self.staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#state. {
119 if src.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
120 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#ctx..get_frame_inforust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]get_frame_info().(&header[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#header_len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
121 }
122 }
123
124 if self.header_onlyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#header_only. {
125 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(header_consumed);
126 }
127
128 let src = &src[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().header_consumed..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
129 let dict_ptr = self.dict_ptrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]dict_ptr().();
130 if let Staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#::Bodyrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body# {
131 ref mut comp_dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/State#Body#comp_dict., ..
132 } = &mut self.staterust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#state.
133 {
134 if dict_ptr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().comp_dict.get_or_insertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]get_or_insert().(dict_ptr) {
135 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo lzzzz 2.0.0 common/error/Error#::newrust-analyzer cargo lzzzz 2.0.0 common/error/impl#[Error]new().(ErrorKindrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#::DictionaryChangedDuringDecompressionrust-analyzer cargo lzzzz 2.0.0 common/error/ErrorKind#DictionaryChangedDuringDecompression#).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
136 }
137
138 let len = self.bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().();
139 if len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().DEFAULT_BUF_SIZErust-analyzer cargo lzzzz 2.0.0 common/DEFAULT_BUF_SIZE. {
140 self.bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer..resize_withrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]resize_with().(DEFAULT_BUF_SIZErust-analyzer cargo lzzzz 2.0.0 common/DEFAULT_BUF_SIZE., Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/impl#[u8][Default]default().)
141 }
142 let (src_len, dst_len, _) =
143 self.ctxrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#ctx.
144 .decompress_dictrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DecompressionContext]decompress_dict().(src, &mut self.bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().len..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()., &self.dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#dict., false)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
145 self.bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer..resize_withrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]resize_with().(len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().dst_len, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/impl#[u8][Default]default().);
146 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(src_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().header_consumed)
147 } else {
148 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(header_consumed)
149 }
150 }
151
152 fn dict_ptrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]dict_ptr().(&self) -> DictPtrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/DictPtr# {
153 let dict = &self.dictrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#dict.;
154 if dict.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
155 DictPtrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/DictPtr#(ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().(), 0)
156 } else {
157 DictPtrrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/DictPtr#(dict.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().(), dict.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().())
158 }
159 }
160
161 pub fn bufrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]buf().(&self) -> &[u8] {
162 &self.bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer.
163 }
164
165 pub fn clear_bufrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/impl#[`Decompressor<'a>`]clear_buf().(&mut self) {
166 self.bufferrust-analyzer cargo lzzzz 2.0.0 lz4f/stream/decomp/Decompressor#buffer..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().();
167 }
168 }