Module sequoia_openpgp::parse::map[][src]

Expand description

Packet maps.

If configured to do so, a PacketParser will create a map that charts the byte-stream, describing where the information was extracted from.


use sequoia_openpgp as openpgp;
use openpgp::parse::{Parse, PacketParserBuilder};

let message_data = b"\xcb\x12t\x00\x00\x00\x00\x00Hello world.";
let pp = PacketParserBuilder::from_bytes(message_data)?
    .map(true) // Enable mapping.
    .expect("One packet, not EOF");
let map ="Mapping is enabled");

assert_eq!(map.iter().nth(0).unwrap().name(), "CTB");
assert_eq!(map.iter().nth(0).unwrap().offset(), 0);
assert_eq!(map.iter().nth(0).unwrap().as_bytes(), &[0xcb]);


Represents an entry in the map.

Map created during parsing.