Function der_parser::der::parse_der_tagged_explicit
source ยท pub fn parse_der_tagged_explicit<'a, T, F>(
tag: T,
f: F,
) -> impl FnMut(&'a [u8]) -> BerResult<'_>
Expand description
Read a TAGGED EXPLICIT value (combinator)
The built object will use the outer header (and tag), and contains a Tagged
object
with class, value and content.
For a generic version (different output and error types), see parse_der_tagged_explicit_g.
The following parses [2] EXPLICIT INTEGER
:
use nom::combinator::map_res;
fn parse_int_explicit(i:&[u8]) -> BerResult<u32> {
map_res(
parse_der_tagged_explicit(2, parse_der_integer),
|x: DerObject| x.as_tagged()?.2.as_u32()
)(i)
}
let res = parse_int_explicit(bytes);