Macro der_parser::parse_der_set_of[][src]

macro_rules! parse_der_set_of {
    ($i : expr, $f : ident) => { ... };
}
Expand description

Parse a set of identical DER elements

Given a subparser for a DER type, parse a set of identical objects.

fn parser(i:&[u8]) -> BerResult {
    parse_der_set_of!(i, 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"),
    BerObject::from_int_slice(b"\x01\x00\x00"),
]);
assert_eq!(parser(&bytes), Ok((empty, expected)));