Function rocket::mtls::x509::ber::parse_ber_implicit

source ·
pub fn parse_ber_implicit<'a, T, F>(
    i: &'a [u8],
    tag: T,
    f: F,
) -> Result<(&'a [u8], BerObject<'a>), Err<Error>>
where F: Fn(&'a [u8], &Header<'_>, usize) -> Result<(&'a [u8], BerObjectContent<'a>), Err<Error>>, T: Into<Tag>,
Available on crate feature mtls only.
Expand description

Parse an implicit tagged object, applying function to read content

Note: unlike explicit tagged functions, the callback must be a content parsing function, often based on the parse_ber_content combinator.

The built object will use the original header (and tag), so the content may not match the tag value.

For a combinator version, see parse_ber_tagged_implicit.

For a generic version (different output and error types), see parse_ber_tagged_implicit_g.

§Examples

The following parses [3] IMPLICIT INTEGER into a BerObject:

fn parse_int_implicit(i:&[u8]) -> BerResult<BerObject> {
    parse_ber_implicit(
        i,
        3,
        parse_ber_content(Tag::Integer),
    )
}

let res = parse_int_implicit(bytes);