rocket::mtls::x509::ber

Function parse_ber_explicit_optional

Source
pub fn parse_ber_explicit_optional<F>(
    i: &[u8],
    tag: Tag,
    f: F,
) -> Result<(&[u8], BerObject<'_>), Err<Error>>
where F: Fn(&[u8]) -> Result<(&[u8], BerObject<'_>), Err<Error>>,
Available on crate feature mtls only.
Expand description

Parse an optional tagged object, applying function to get content

This function returns a BerObject, trying to read content as generic BER objects. If parsing failed, return an optional object containing None.

To support other return or error types, use parse_ber_tagged_explicit_g

This function will never fail: if parsing content failed, the BER value Optional(None) is returned.