fn decode_long(
        decoder: &mut Decoder<'a>,
        packet_type: PacketType,
        version: Version,
    ) -> Res<(&'a [u8], usize)> {
        if packet_type == PacketType::Retry {
            let header_len = decoder.offset();
            let expansion = retry::expansion(version);
            let token = Self::opt(decoder.decode(decoder.remaining() - expansion))?;
            if token.is_empty() {
                return Err(Error::InvalidPacket);
            }
            Self::opt(decoder.decode(expansion))?;
            return Ok((token, header_len));
        }
        let token = if packet_type == PacketType::Initial {
            Self::opt(decoder.decode_vvec())?
        } else {
            &[]
        };
        let len = Self::opt(decoder.decode_varint())?;
        let header_len = decoder.offset();
        let _body = Self::opt(decoder.decode(usize::try_from(len)?))?;
        Ok((token, header_len))
    }
/// Decode the type-specific portions of a long header.
/// This includes reading the length and the remainder of the packet.
/// Returns a tuple of any token and the length of the header.
Decode the type-specific portions of a long header.
This includes reading the length and the remainder of the packet.
Returns a tuple of any token and the length of the header.
Decode the type - specific portions of a long header . This includes reading the length and the remainder of the packet . Returns a tuple of any token and the length of the header .
fn decode_long(
        decoder: &mut Decoder<'a>,
        packet_type: PacketType,
        version: Version,
    ) -> Res<(&'a [u8], usize)> {
        if packet_type == PacketType::Retry {
            let header_len = decoder.offset();
            let expansion = retry::expansion(version);
            let token = Self::opt(decoder.decode(decoder.remaining() - expansion))?;
            if token.is_empty() {
                return Err(Error::InvalidPacket);
            }
            Self::opt(decoder.decode(expansion))?;
            return Ok((token, header_len));
        }
        let token = if packet_type == PacketType::Initial {
            Self::opt(decoder.decode_vvec())?
        } else {
            &[]
        };
        let len = Self::opt(decoder.decode_varint())?;
        let header_len = decoder.offset();
        let _body = Self::opt(decoder.decode(usize::try_from(len)?))?;
        Ok((token, header_len))
    }
fn decode_long ( decoder : & mut Decoder < ' a > , packet_type : PacketType , version : Version , ) -> Res < ( & ' a [ u8 ] , usize ) > { if packet_type == PacketType :: Retry { let header_len = decoder . offset ( ) ; let expansion = retry :: expansion ( version ) ; let token = Self :: opt ( decoder . decode ( decoder . remaining ( ) - expansion ) ) ? ; if token . is_empty ( ) { return Err ( Error :: InvalidPacket ) ; } Self :: opt ( decoder . decode ( expansion ) ) ? ; return Ok ( ( token , header_len ) ) ; } let token = if packet_type == PacketType :: Initial { Self :: opt ( decoder . decode_vvec ( ) ) ? } else { & [ ] } ; let len = Self :: opt ( decoder . decode_varint ( ) ) ? ; let header_len = decoder . offset ( ) ; let _body = Self :: opt ( decoder . decode ( usize :: try_from ( len ) ? ) ) ? ; Ok ( ( token , header_len ) ) }
Decode the type-specific portions of a long header.
Decode the type - specific portions of a long header .
decoder
&mut Decoder<'a>
packet_type
PacketType
version
Version