fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D,
                                    expected_tag: T)
                                    -> Result<V, D::Error>
    where T: Decodable + Eq + ::std::fmt::Debug,
          V: Decodable,
          D: DecoderWithPosition,
          'tcx: 'a,
{
    let start_pos = decoder.position();

    let actual_tag = T::decode(decoder)?;
    assert_eq!(actual_tag, expected_tag);
    let value = V::decode(decoder)?;
    let end_pos = decoder.position();

    let expected_len: u64 = Decodable::decode(decoder)?;
    assert_eq!((end_pos - start_pos) as u64, expected_len);

    Ok(value)
}
// Decode something that was encoded with encode_tagged() and verify that the
// tag matches and the correct amount of bytes was read.
Decode something that was encoded with encode_tagged() and verify that the
tag matches and the correct amount of bytes was read.
Decode something that was encoded with encode_tagged () and verify that the tag matches and the correct amount of bytes was read .
fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D,
                                    expected_tag: T)
                                    -> Result<V, D::Error>
    where T: Decodable + Eq + ::std::fmt::Debug,
          V: Decodable,
          D: DecoderWithPosition,
          'tcx: 'a,
{
    let start_pos = decoder.position();
    let actual_tag = T::decode(decoder)?;
    assert_eq!(actual_tag, expected_tag);
    let value = V::decode(decoder)?;
    let end_pos = decoder.position();
    let expected_len: u64 = Decodable::decode(decoder)?;
    assert_eq!((end_pos - start_pos) as u64, expected_len);
    Ok(value)
}
fn decode_tagged < ' a , ' tcx , D , T , V > ( decoder : & mut D , expected_tag : T ) -> Result < V , D :: Error > where T : Decodable + Eq + :: std :: fmt :: Debug , V : Decodable , D : DecoderWithPosition , ' tcx : ' a , { let start_pos = decoder . position ( ) ; let actual_tag = T :: decode ( decoder ) ? ; assert_eq ! ( actual_tag expected_tag ) ; let value = V :: decode ( decoder ) ? ; let end_pos = decoder . position ( ) ; let expected_len : u64 = Decodable :: decode ( decoder ) ? ; assert_eq ! ( ( end_pos start_pos ) as u64 expected_len ) ; Ok ( value ) }
Decode something that was encoded with encode_tagged() and verify that the
tag matches and the correct amount of bytes was read.
Decode something that was encoded with encode_tagged () and verify that the tag matches and the correct amount of bytes was read .
decoder
&mut D
expected_tag
T