Debian Codegraph @

src/stream/read/mod.rs

raw symbols SCIP
1 //! Implement pull-based [`Read`] trait for both compressing and decompressing.
2 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/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#, BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#};
3
4 use craterust-analyzer cargo zstd 0.13.3 crate/::dictrust-analyzer cargo zstd 0.13.3 dict/::{DecoderDictionaryrust-analyzer cargo zstd 0.13.3 dict/DecoderDictionary#, EncoderDictionaryrust-analyzer cargo zstd 0.13.3 dict/EncoderDictionary#};
5 use craterust-analyzer cargo zstd 0.13.3 crate/::streamrust-analyzer cargo zstd 0.13.3 stream/::{rawrust-analyzer cargo zstd 0.13.3 stream/raw/, ziorust-analyzer cargo zstd 0.13.3 stream/zio/};
6 use zstd_saferust-analyzer cargo zstd-safe 7.2.2 crate/;
7
8 #[cfg(test)]
9 mod testsrust-analyzer cargo zstd 0.13.3 stream/read/tests/;
10
11 /// A decoder that decompress input data from another `Read`.
12 ///
13 /// This allows to read a stream of compressed data
14 /// (good for files or heavy network stream).
15 pub struct Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#<'a, R> {
16 readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader.: ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#<R, rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Decoderrust-analyzer cargo zstd 0.13.3 stream/raw/Decoder#<'a>>,
17 }
18
19 /// An encoder that compress input data from another `Read`.
20 pub struct Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#<'a, R> {
21 readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader.: ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#<R, rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Encoderrust-analyzer cargo zstd 0.13.3 stream/raw/Encoder#<'a>>,
22 }
23
24 impl<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#> Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#<'static, BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#<R>> {
25 /// Creates a new decoder.
26 pub fn newrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, BufReader<R>>`]new().(reader: R) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, BufReader<R>>`]> {
27 let buffer_size = zstd_saferust-analyzer cargo zstd-safe 7.2.2 crate/::DCtxrust-analyzer cargo zstd-safe 7.2.2 DCtx#::in_sizerust-analyzer cargo zstd-safe 7.2.2 impl#[`DCtx<'a>`]in_size().();
28
29 Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, BufReader<R>>`]::with_bufferrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, R>`]with_buffer().(BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::with_capacityrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]with_capacity().(buffer_size, reader))
30 }
31 }
32
33 impl<R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#> Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#<'static, R> {
34 /// Creates a new decoder around a `BufRead`.
35 pub fn with_bufferrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, R>`]with_buffer().(reader: R) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, R>`]> {
36 Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, R>`]::with_dictionaryrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, R>`]with_dictionary().(reader, &[])
37 }
38 /// Creates a new decoder, using an existing dictionary.
39 ///
40 /// The dictionary must be the same as the one used during compression.
41 pub fn with_dictionaryrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, R>`]with_dictionary().(reader: R, dictionary: &[u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, R>`]> {
42 let decoder = rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Decoderrust-analyzer cargo zstd 0.13.3 stream/raw/Decoder#::with_dictionaryrust-analyzer cargo zstd 0.13.3 stream/raw/impl#[`Decoder<'static>`]with_dictionary().(dictionary)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
43 let reader = ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#::newrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]new().(reader, decoder);
44
45 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder# { readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader. })
46 }
47 }
48 impl<'a, R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#> Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#<'a, R> {
49 /// Creates a new decoder which employs the provided context for deserialization.
50 pub fn with_contextrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]with_context().(
51 reader: R,
52 context: &'a mut zstd_saferust-analyzer cargo zstd-safe 7.2.2 crate/::DCtxrust-analyzer cargo zstd-safe 7.2.2 DCtx#<'static>,
53 ) -> Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`] {
54 Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`] {
55 readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader.: ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#::newrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]new().(
56 reader,
57 rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Decoderrust-analyzer cargo zstd 0.13.3 stream/raw/Decoder#::with_contextrust-analyzer cargo zstd 0.13.3 stream/raw/impl#[`Decoder<'a>`]with_context().(context),
58 ),
59 }
60 }
61
62 /// Sets this `Decoder` to stop after the first frame.
63 ///
64 /// By default, it keeps concatenating frames until EOF is reached.
65 #[must_use]
66 pub fn single_framerust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]single_frame().(mut self) -> Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`] {
67 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader..set_single_framerust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]set_single_frame().();
68 self
69 }
70
71 /// Creates a new decoder, using an existing `DecoderDictionary`.
72 ///
73 /// The dictionary must be the same as the one used during compression.
74 pub fn with_prepared_dictionaryrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]with_prepared_dictionary().<'b>(
75 reader: R,
76 dictionary: &DecoderDictionaryrust-analyzer cargo zstd 0.13.3 dict/DecoderDictionary#<'b>,
77 ) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]>
78 where
79 'b: 'a,
80 {
81 let decoder = rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Decoderrust-analyzer cargo zstd 0.13.3 stream/raw/Decoder#::with_prepared_dictionaryrust-analyzer cargo zstd 0.13.3 stream/raw/impl#[`Decoder<'a>`]with_prepared_dictionary().(dictionary)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
82 let reader = ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#::newrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]new().(reader, decoder);
83
84 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder# { readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader. })
85 }
86
87 /// Creates a new decoder, using a ref prefix.
88 ///
89 /// The prefix must be the same as the one used during compression.
90 pub fn with_ref_prefixrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]with_ref_prefix().<'b>(
91 reader: R,
92 ref_prefix: &'b [u8],
93 ) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]>
94 where
95 'b: 'a,
96 {
97 let decoder = rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Decoderrust-analyzer cargo zstd 0.13.3 stream/raw/Decoder#::with_ref_prefixrust-analyzer cargo zstd 0.13.3 stream/raw/impl#[`Decoder<'a>`]with_ref_prefix().(ref_prefix)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
98 let reader = ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#::newrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]new().(reader, decoder);
99
100 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder# { readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader. })
101 }
102
103 /// Recommendation for the size of the output buffer.
104 pub fn recommended_output_sizerust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]recommended_output_size().() -> usize {
105 zstd_saferust-analyzer cargo zstd-safe 7.2.2 crate/::DCtxrust-analyzer cargo zstd-safe 7.2.2 DCtx#::out_sizerust-analyzer cargo zstd-safe 7.2.2 impl#[`DCtx<'a>`]out_size().()
106 }
107
108 /// Acquire a reference to the underlying reader.
109 pub fn get_refrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]get_ref().(&self) -> &R {
110 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader..readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]reader().()
111 }
112
113 /// Acquire a mutable reference to the underlying reader.
114 ///
115 /// Note that mutation of the reader may result in surprising results if
116 /// this decoder is continued to be used.
117 pub fn get_mutrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]get_mut().(&mut self) -> &mut R {
118 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader..reader_mutrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]reader_mut().()
119 }
120
121 /// Return the inner `Read`.
122 ///
123 /// Calling `finish()` is not *required* after reading a stream -
124 /// just use it if you need to get the `Read` back.
125 pub fn finishrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'a, R>`]finish().(self) -> R {
126 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader..into_innerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]into_inner().()
127 }
128
129 craterust-analyzer cargo zstd 0.13.3 crate/::decoder_commonrust-analyzer cargo zstd 0.13.3 stream/decoder_common!!(readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader.);
130 }
131
132 impl<R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#> Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# for Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#<'_, R> {
133 fn readrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'_, R>`][Read]read().(&mut self, buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
134 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#reader..readrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`][Read]read().(buf)
135 }
136 }
137
138 impl<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#> Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#<'static, BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#<R>> {
139 /// Creates a new encoder.
140 pub fn newrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, BufReader<R>>`]new().(reader: R, level: i32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, BufReader<R>>`]> {
141 let buffer_size = zstd_saferust-analyzer cargo zstd-safe 7.2.2 crate/::CCtxrust-analyzer cargo zstd-safe 7.2.2 CCtx#::in_sizerust-analyzer cargo zstd-safe 7.2.2 impl#[`CCtx<'a>`]in_size().();
142
143 Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, BufReader<R>>`]::with_bufferrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, R>`]with_buffer().(BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::with_capacityrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]with_capacity().(buffer_size, reader), level)
144 }
145 }
146
147 impl<R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#> Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#<'static, R> {
148 /// Creates a new encoder around a `BufRead`.
149 pub fn with_bufferrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, R>`]with_buffer().(reader: R, level: i32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, R>`]> {
150 Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, R>`]::with_dictionaryrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, R>`]with_dictionary().(reader, level, &[])
151 }
152
153 /// Creates a new encoder, using an existing dictionary.
154 ///
155 /// The dictionary must be the same as the one used during compression.
156 pub fn with_dictionaryrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, R>`]with_dictionary().(
157 reader: R,
158 level: i32,
159 dictionary: &[u8],
160 ) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, R>`]> {
161 let encoder = rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Encoderrust-analyzer cargo zstd 0.13.3 stream/raw/Encoder#::with_dictionaryrust-analyzer cargo zstd 0.13.3 stream/raw/impl#[`Encoder<'static>`]with_dictionary().(level, dictionary)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
162 let reader = ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#::newrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]new().(reader, encoder);
163
164 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder# { readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader. })
165 }
166 }
167
168 impl<'a, R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#> Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#<'a, R> {
169 /// Creates a new encoder, using an existing `EncoderDictionary`.
170 ///
171 /// The dictionary must be the same as the one used during compression.
172 pub fn with_prepared_dictionaryrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'a, R>`]with_prepared_dictionary().<'b>(
173 reader: R,
174 dictionary: &EncoderDictionaryrust-analyzer cargo zstd 0.13.3 dict/EncoderDictionary#<'b>,
175 ) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Selfrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'a, R>`]>
176 where
177 'b: 'a,
178 {
179 let encoder = rawrust-analyzer cargo zstd 0.13.3 stream/raw/::Encoderrust-analyzer cargo zstd 0.13.3 stream/raw/Encoder#::with_prepared_dictionaryrust-analyzer cargo zstd 0.13.3 stream/raw/impl#[`Encoder<'a>`]with_prepared_dictionary().(dictionary)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
180 let reader = ziorust-analyzer cargo zstd 0.13.3 stream/zio/::Readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/Reader#::newrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]new().(reader, encoder);
181
182 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder# { readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader. })
183 }
184
185 /// Recommendation for the size of the output buffer.
186 pub fn recommended_output_sizerust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'a, R>`]recommended_output_size().() -> usize {
187 zstd_saferust-analyzer cargo zstd-safe 7.2.2 crate/::CCtxrust-analyzer cargo zstd-safe 7.2.2 CCtx#::out_sizerust-analyzer cargo zstd-safe 7.2.2 impl#[`CCtx<'a>`]out_size().()
188 }
189
190 /// Acquire a reference to the underlying reader.
191 pub fn get_refrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'a, R>`]get_ref().(&self) -> &R {
192 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader..readerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]reader().()
193 }
194
195 /// Acquire a mutable reference to the underlying reader.
196 ///
197 /// Note that mutation of the reader may result in surprising results if
198 /// this encoder is continued to be used.
199 pub fn get_mutrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'a, R>`]get_mut().(&mut self) -> &mut R {
200 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader..reader_mutrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]reader_mut().()
201 }
202
203 /// Flush any internal buffer.
204 ///
205 /// This ensures all input consumed so far is compressed.
206 ///
207 /// Since it prevents bundling currently buffered data with future input,
208 /// it may affect compression ratio.
209 ///
210 /// * Returns the number of bytes written to `out`.
211 /// * Returns `Ok(0)` when everything has been flushed.
212 pub fn flushrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'a, R>`]flush().(&mut self, out: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
213 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader..flushrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]flush().(out)
214 }
215
216 /// Return the inner `Read`.
217 ///
218 /// Calling `finish()` is not *required* after reading a stream -
219 /// just use it if you need to get the `Read` back.
220 pub fn finishrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'a, R>`]finish().(self) -> R {
221 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader..into_innerrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`]into_inner().()
222 }
223
224 craterust-analyzer cargo zstd 0.13.3 crate/::encoder_commonrust-analyzer cargo zstd 0.13.3 stream/encoder_common!!(readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader.);
225 }
226
227 impl<R: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#> Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# for Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#<'_, R> {
228 fn readrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'_, R>`][Read]read().(&mut self, buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
229 self.readerrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#reader..readrust-analyzer cargo zstd 0.13.3 stream/zio/reader/impl#[`Reader<R, D>`][Read]read().(buf)
230 }
231 }
232
233 fn _assert_traitsrust-analyzer cargo zstd 0.13.3 stream/read/_assert_traits().() {
234 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/::Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#;
235
236 fn _assert_sendrust-analyzer cargo zstd 0.13.3 stream/read/_assert_send().<T: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>(_: T) {}
237
238 _assert_sendrust-analyzer cargo zstd 0.13.3 stream/read/_assert_send().(Decoderrust-analyzer cargo zstd 0.13.3 stream/read/Decoder#::newrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Decoder<'static, BufReader<R>>`]new().(Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(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().())));
239 _assert_sendrust-analyzer cargo zstd 0.13.3 stream/read/_assert_send().(Encoderrust-analyzer cargo zstd 0.13.3 stream/read/Encoder#::newrust-analyzer cargo zstd 0.13.3 stream/read/impl#[`Encoder<'static, BufReader<R>>`]new().(Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(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().()), 1));
240 }