pub fn decode_tag(bytes: &[u8]) -> Result<Option<(u64, Varint, usize)>, EbmlError> {
    // parse element ID
    match decode_varint(bytes) {
        Ok(None) => Ok(None),
        Err(err) => Err(err),
        Ok(Some((Varint::Unknown, _))) => Err(EbmlError::UnknownElementId),
        Ok(Some((Varint::Value(element_id), id_size))) => {
            // parse payload size
            match decode_varint(&bytes[id_size..]) {
                Ok(None) => Ok(None),
                Err(err) => Err(err),
                Ok(Some((element_length, length_size))) =>
                    Ok(Some((
                        element_id,
                        element_length,
                        id_size + length_size
                    )))
            }
        }
    }
}
/// Try to parse an EBML element header at the start of the given slice.
/// Returns an Err() if the format is corrupt.
/// Returns Ok(None) if more bytes are needed to get a result.
/// Returns Ok(Some((id, varint, size))) to return the element id,
/// the size of the payload, and the size of the parsed header.
Try to parse an EBML element header at the start of the given slice.
Returns an Err() if the format is corrupt.
Returns Ok(None) if more bytes are needed to get a result.
Returns Ok(Some((id, varint, size))) to return the element id,
the size of the payload, and the size of the parsed header.
Try to parse an EBML element header at the start of the given slice . Returns an Err () if the format is corrupt . Returns Ok ( None ) if more bytes are needed to get a result . Returns Ok ( Some (( id varint size ))) to return the element id the size of the payload and the size of the parsed header .
pub fn decode_tag(bytes: &[u8]) -> Result<Option<(u64, Varint, usize)>, EbmlError> {
    // parse element ID
    match decode_varint(bytes) {
        Ok(None) => Ok(None),
        Err(err) => Err(err),
        Ok(Some((Varint::Unknown, _))) => Err(EbmlError::UnknownElementId),
        Ok(Some((Varint::Value(element_id), id_size))) => {
            // parse payload size
            match decode_varint(&bytes[id_size..]) {
                Ok(None) => Ok(None),
                Err(err) => Err(err),
                Ok(Some((element_length, length_size))) =>
                    Ok(Some((
                        element_id,
                        element_length,
                        id_size + length_size
                    )))
            }
        }
    }
}
pub fn decode_tag ( bytes : & [ u8 ] ) -> Result < Option < ( u64 , Varint , usize ) > , EbmlError > { // parse element ID match decode_varint ( bytes ) { Ok ( None ) => Ok ( None ) , Err ( err ) => Err ( err ) , Ok ( Some ( ( Varint :: Unknown , _ ) ) ) => Err ( EbmlError :: UnknownElementId ) , Ok ( Some ( ( Varint :: Value ( element_id ) , id_size ) ) ) => { // parse payload size match decode_varint ( & bytes [ id_size .. ] ) { Ok ( None ) => Ok ( None ) , Err ( err ) => Err ( err ) , Ok ( Some ( ( element_length , length_size ) ) ) => Ok ( Some ( ( element_id , element_length , id_size + length_size ) ) ) } } } }
Try to parse an EBML element header at the start of the given slice.
Try to parse an EBML element header at the start of the given slice .
bytes
&[u8]
bytes
&[u8]