diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-01-21 11:55:35 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-01-21 11:55:47 +0100 |
commit | 0572b8545e9ee92e41e56f36cbe1aaf8129fa2d3 (patch) | |
tree | c5c75eeaeaeabd5ae140efe0de738a72eec95237 /openpgp-ffi/src | |
parent | a8f74515b104a79d899f7ab25a60b03665f94d7f (diff) |
openpgp-ffi: Add example.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/fingerprint.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/openpgp-ffi/src/fingerprint.rs b/openpgp-ffi/src/fingerprint.rs index 2dac4224..d177029d 100644 --- a/openpgp-ffi/src/fingerprint.rs +++ b/openpgp-ffi/src/fingerprint.rs @@ -27,6 +27,25 @@ pub extern "system" fn pgp_fingerprint_from_bytes(buf: *const uint8_t, } /// Reads a hexadecimal fingerprint. +/// +/// # Example +/// +/// ```c +/// #include <assert.h> +/// #include <stdlib.h> +/// #include <string.h> +/// #include <sequoia/openpgp.h> +/// +/// pgp_fingerprint_t fp = +/// pgp_fingerprint_from_hex ("D2F2C5D45BE9FDE6A4EE0AAF31855247603831FD"); +/// +/// char *pretty = pgp_fingerprint_to_string (fp); +/// assert (strcmp (pretty, +/// "D2F2 C5D4 5BE9 FDE6 A4EE 0AAF 3185 5247 6038 31FD") == 0); +/// +/// free (pretty); +/// pgp_fingerprint_free (fp); +/// ``` #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_fingerprint_from_hex(hex: *const c_char) -> *mut Fingerprint { |