mlalic / hpack-rs

An HPACK coder implementation in Rust
MIT License
13 stars 9 forks source link

Example from the main page doesn't work with 0.3.0 #3

Open aleksmelnikov opened 5 years ago

aleksmelnikov commented 5 years ago
let mut encoder = Encoder::new();
let headers = vec![
    (b":method".to_vec(), b"GET".to_vec()),
    (b":path".to_vec(), b"/".to_vec()),
];
// The headers are encoded by providing their index (with a bit flag
// indicating that the indexed representation is used).
assert_eq!(encoder.encode(&headers), vec![2 | 0x80, 4 | 0x80]);

Gives the error with 0.3.0 crate version:

    Updating crates.io index
   Compiling hpack v0.3.0
   Compiling test_hpack_1 v0.1.0 (/at/rust/workspace/test_hpack_1)
error[E0271]: type mismatch resolving `<&std::vec::Vec<(std::vec::Vec<u8>, std::vec::Vec<u8>)> as std::iter::IntoIterator>::Item == (&[u8], &[u8])`
  --> test_hpack_1/src/main.rs:13:20
   |
13 | assert_eq!(encoder.encode(&headers), vec![2 | 0x80, 4 | 0x80]);
   |                    ^^^^^^ expected reference, found tuple
   |
   = note: expected type `&(std::vec::Vec<u8>, std::vec::Vec<u8>)`
              found type `(&[u8], &[u8])`
MoMannn commented 4 years ago

Same issue:

expected reference `&(std::vec::Vec<u8>, std::vec::Vec<u8>)`
             found tuple `(&[u8], &[u8])`