pub fn parse_ber_tagged_explicit<'a, T, F>(
    tag: T,
    f: F
) -> impl FnMut(&'a [u8]) -> BerResult<'_> where
    F: Fn(&'a [u8]) -> BerResult<'_, BerObject<'_>>,
    T: Into<Tag>, 
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> {
   map_res(
       parse_ber_tagged_explicit(2, parse_ber_integer),
       |x: BerObject| x.as_tagged()?.2.as_u32()
   )(i)
}

let res = parse_int_explicit(bytes);