Function rocket::mtls::x509::der_parser::ber::parse_ber_tagged_explicit

source ยท
pub fn parse_ber_tagged_explicit<'a, T, F>(tag: T, f: F) -> impl FnMut(&'a [u8])
where F: Fn(&'a [u8]) -> Result<(&'a [u8], BerObject<'a>), Err<Error>>, T: Into<Tag>,
Available on crate feature mtls only.
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_ber_tagged_explicit_g.

The following parses [2] EXPLICIT INTEGER:

use nom::combinator::map_res;
fn parse_int_explicit(i:&[u8]) -> BerResult<u32> {
       parse_ber_tagged_explicit(2, parse_ber_integer),
       |x: BerObject| x.as_tagged()?.2.as_u32()

let res = parse_int_explicit(bytes);