summaryrefslogtreecommitdiffstats
path: root/ffi/src/openpgp/keyid.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-01-08 18:30:19 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-01-08 18:31:22 +0100
commit8433faaa9328ce6516722af73ba92422bb5557c7 (patch)
tree770fabf1d82f9970635931e77bd08117f8b60954 /ffi/src/openpgp/keyid.rs
parent6dee642bad3c7b9c126a92d4a62eaae4fe3d713b (diff)
ffi: Add test.
Diffstat (limited to 'ffi/src/openpgp/keyid.rs')
-rw-r--r--ffi/src/openpgp/keyid.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/ffi/src/openpgp/keyid.rs b/ffi/src/openpgp/keyid.rs
index 5d739609..bc4a2ace 100644
--- a/ffi/src/openpgp/keyid.rs
+++ b/ffi/src/openpgp/keyid.rs
@@ -16,6 +16,22 @@ use self::sequoia_openpgp::KeyID;
use build_hasher;
/// Reads a binary key ID.
+///
+/// # Example
+///
+/// ```c
+/// #include <assert.h>
+/// #include <string.h>
+/// #include <sequoia.h>
+///
+/// sq_keyid_t mr_b = sq_keyid_from_bytes ("\xbb\xbb\xbb\xbb\xbb\xbb\xbb\xbb");
+///
+/// char *mr_b_as_string = sq_keyid_to_string (mr_b);
+/// assert (strcmp (mr_b_as_string, "BBBB BBBB BBBB BBBB") == 0);
+///
+/// sq_keyid_free (mr_b);
+/// sq_string_free (mr_b_as_string);
+/// ```
#[no_mangle]
pub extern "system" fn sq_keyid_from_bytes(id: *const uint8_t) -> *mut KeyID {
assert!(!id.is_null());