pub fn parse_ber_tagged_implicit<'a, T, F, E>(
    tag: u32,
    f: F
) -> impl Fn(&'a [u8]) -> IResult<&[u8], T, E>where
    F: Fn(&'a [u8], &BerObjectHeader<'_>, usize) -> IResult<&'a [u8], T, E>,
    E: ParseError<&'a [u8]> + From<BerError>,
Expand description

Read a TAGGED IMPLICIT value (function version)

The following parses [2] IMPLICIT INTEGER:

use nom::combinator::map_res;
fn parse_int_implicit(i:&[u8]) -> BerResult<u32> {
    map_res(
        parse_ber_tagged_implicit(
            2,
            parse_ber_content(BerTag::Integer),
        ),
        |x: BerObjectContent| x.as_u32()
    )(i)
}

let res = parse_int_implicit(bytes);