pub enum DecoderOutput {
Done(Vec<Header>),
BlockedStream,
}Expand description
The result of a decode operation.
Generally, this is function’s output for Decoder::decode.
When header data are decoded,
Variants§
Done(Vec<Header>)
The header block has been correctly decoded.
BlockedStream
The deocding stream is blocked.
More data are needed in order to proceed with decoding operation.
Generally, you need to feed the encoder via Decoder::feed.
Implementations§
Source§impl DecoderOutput
impl DecoderOutput
Sourcepub fn take(self) -> Option<Vec<Header>>
pub fn take(self) -> Option<Vec<Header>>
If the result is unblocked, it will return Some(Vec<header>).
Otherwise None.
Examples found in repository?
examples/simple.rs (line 16)
7fn main() {
8 let (encoded_headers, _) = Encoder::new()
9 .encode_all(StreamId::new(0), HEADERS)
10 .unwrap()
11 .into();
12
13 let decoded_headers = Decoder::new(0, 0)
14 .decode(StreamId::new(0), encoded_headers)
15 .unwrap()
16 .take()
17 .unwrap();
18
19 println!("Decoded header: {:?}", decoded_headers);
20}More examples
examples/dyn_table.rs (line 32)
7fn main() {
8 let mut encoder = Encoder::new();
9 let sdtc_data = encoder.configure(1024, 1024, 1).unwrap();
10
11 let (encoded_hdr_data, encoded_stream_data) = encoder
12 .encode_all(StreamId::new(0), HEADERS)
13 .unwrap()
14 .into();
15
16 println!("Encoding ratio: {}", encoder.ratio());
17
18 let mut decoder = Decoder::new(1024, 1);
19 decoder.feed(sdtc_data).unwrap();
20
21 let decoder_status = decoder.decode(StreamId::new(0), encoded_hdr_data).unwrap();
22
23 assert!(decoder_status.is_blocked());
24 println!("Decoder blocked. Stream data needed");
25
26 decoder.feed(encoded_stream_data).unwrap();
27
28 let decoded_hdr = decoder
29 .unblocked(StreamId::new(0))
30 .unwrap()
31 .unwrap()
32 .take()
33 .unwrap();
34
35 println!("Decoded header: {:?}", decoded_hdr);
36}Sourcepub fn is_blocked(&self) -> bool
pub fn is_blocked(&self) -> bool
Checks whether the result is blocked or not.
Examples found in repository?
examples/dyn_table.rs (line 23)
7fn main() {
8 let mut encoder = Encoder::new();
9 let sdtc_data = encoder.configure(1024, 1024, 1).unwrap();
10
11 let (encoded_hdr_data, encoded_stream_data) = encoder
12 .encode_all(StreamId::new(0), HEADERS)
13 .unwrap()
14 .into();
15
16 println!("Encoding ratio: {}", encoder.ratio());
17
18 let mut decoder = Decoder::new(1024, 1);
19 decoder.feed(sdtc_data).unwrap();
20
21 let decoder_status = decoder.decode(StreamId::new(0), encoded_hdr_data).unwrap();
22
23 assert!(decoder_status.is_blocked());
24 println!("Decoder blocked. Stream data needed");
25
26 decoder.feed(encoded_stream_data).unwrap();
27
28 let decoded_hdr = decoder
29 .unblocked(StreamId::new(0))
30 .unwrap()
31 .unwrap()
32 .take()
33 .unwrap();
34
35 println!("Decoded header: {:?}", decoded_hdr);
36}Auto Trait Implementations§
impl Freeze for DecoderOutput
impl RefUnwindSafe for DecoderOutput
impl Send for DecoderOutput
impl Sync for DecoderOutput
impl Unpin for DecoderOutput
impl UnwindSafe for DecoderOutput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more