Macro der_parser::parse_der_set_defined_m
source · macro_rules! parse_der_set_defined_m { ($i:expr, $($args:tt)*) => { ... }; }
👎Deprecated since 3.0.0: Use parse_der_set_defined
Expand description
Parse a defined set of DER elements
Given a list of expected parsers, apply them to build a DER set.
fn localparse_set(i:&[u8]) -> BerResult {
parse_der_set_defined_m!(i,
parse_ber_integer >>
// macros can also be called
call!(parse_ber_integer)
)
}
let empty = &b""[..];
let bytes = [ 0x31, 0x0a,
0x02, 0x03, 0x01, 0x00, 0x01,
0x02, 0x03, 0x01, 0x00, 0x00,
];
let expected = BerObject::from_set(vec![
BerObject::from_int_slice(b"\x01\x00\x01").set_raw_tag(Some(&[0x2])),
BerObject::from_int_slice(b"\x01\x00\x00").set_raw_tag(Some(&[0x2])),
]).set_raw_tag(Some(&[0x31]));
assert_eq!(localparse_set(&bytes), Ok((empty, expected)));