pub fn deserialize_from<'de, R, T, S>(reader: R, size_limit: S) -> Result<T>
where
    R: Read,
    T: serde::Deserialize<'de>,
    S: SizeLimit,
{
    use crate::encapsulation::ENCAPSULATION_HEADER_SIZE;

    let mut deserializer = Deserializer::<_, S, BigEndian>::new(reader, size_limit);

    let v: [u8; ENCAPSULATION_HEADER_SIZE as usize] =
        serde::Deserialize::deserialize(&mut deserializer)?;
    deserializer.reset_pos();
    match v[1] {
        0 | 2 => serde::Deserialize::deserialize(&mut deserializer),
        1 | 3 => serde::Deserialize::deserialize(
            &mut Into::<Deserializer<_, _, LittleEndian>>::into(deserializer),
        ),
        _ => Err(Error::InvalidEncapsulation),
    }
}
/// Deserializes an object directly from a `Read`.
Deserializes an object directly from a `Read`.
Deserializes an object directly from a ` Read ` .
pub fn deserialize_from<'de, R, T, S>(reader: R, size_limit: S) -> Result<T>
where
    R: Read,
    T: serde::Deserialize<'de>,
    S: SizeLimit,
{
    use crate::encapsulation::ENCAPSULATION_HEADER_SIZE;
    let mut deserializer = Deserializer::<_, S, BigEndian>::new(reader, size_limit);
    let v: [u8; ENCAPSULATION_HEADER_SIZE as usize] =
        serde::Deserialize::deserialize(&mut deserializer)?;
    deserializer.reset_pos();
    match v[1] {
        0 | 2 => serde::Deserialize::deserialize(&mut deserializer),
        1 | 3 => serde::Deserialize::deserialize(
            &mut Into::<Deserializer<_, _, LittleEndian>>::into(deserializer),
        ),
        _ => Err(Error::InvalidEncapsulation),
    }
}
pub fn deserialize_from < ' de , R , T , S > ( reader : R , size_limit : S ) -> Result < T > where R : Read , T : serde :: Deserialize < ' de > , S : SizeLimit , { use crate :: encapsulation :: ENCAPSULATION_HEADER_SIZE ; let mut deserializer = Deserializer :: < _ , S , BigEndian > :: new ( reader , size_limit ) ; let v : [ u8 ; ENCAPSULATION_HEADER_SIZE as usize ] = serde :: Deserialize :: deserialize ( & mut deserializer ) ? ; deserializer . reset_pos ( ) ; match v [ 1 ] { 0 | 2 => serde :: Deserialize :: deserialize ( & mut deserializer ) , 1 | 3 => serde :: Deserialize :: deserialize ( & mut Into :: < Deserializer < _ , _ , LittleEndian > > :: into ( deserializer ) , ) , _ => Err ( Error :: InvalidEncapsulation ) , } }
Deserializes an object directly from a `Read`.
Deserializes an object directly from a ` Read ` .
reader
R
size_limit
S
reader
R
size_limit
S