diff options
author | Neal H. Walfield <neal@pep.foundation> | 2019-03-28 09:28:22 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2019-04-01 14:24:47 +0200 |
commit | 7b4fb104ddda95f145cbd360f10503a8614dd8b3 (patch) | |
tree | 95435083c1a3e201d6db71338d74b67663d747e2 /openpgp-ffi/src/packet | |
parent | 82d8ace551e4310df8135f7e6b7eec1d0fe256aa (diff) |
openpgp-ffi: Add a convenience function to pretty print a packet
Diffstat (limited to 'openpgp-ffi/src/packet')
-rw-r--r-- | openpgp-ffi/src/packet/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/openpgp-ffi/src/packet/mod.rs b/openpgp-ffi/src/packet/mod.rs index a2d557e3..52ffaee5 100644 --- a/openpgp-ffi/src/packet/mod.rs +++ b/openpgp-ffi/src/packet/mod.rs @@ -91,3 +91,11 @@ pub extern "system" fn pgp_tag_to_string(tag: uint8_t) -> *const c_char { _ => "OTHER\x00", }.as_bytes().as_ptr() as *const c_char } + +/// Pretty prints a packet +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "system" fn pgp_packet_debug(p: *const Packet) -> *const c_char { + let p = ffi_param_ref!(p); + format!("{:?}", p).as_ptr() as *const c_char +} + |