pub fn strip_tlv(data: &[u8]) -> ParseResult<(Tlv<'_>, &[u8])>
Expand description
Attempts to parse the Tlv
at the start of data
(allows trailing data).
If successful, the Tlv
and the trailing data after it are returned, if
unsuccessful a ParseError
is returned.
This can be useful where you have a file or stream format that relies on ASN.1 TLVs for framing.
When parsing a stream, if an error is returned, if its kind
is
ParseErrorKind::ShortData
, this indicates that data
did not contain
sufficient data to parse an entire Tlv
, and thus adding more data may
resolve this. All other errors are “fatal” and cannot be resolved with
additional data.