diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-03-25 14:39:43 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-03-25 16:54:11 +0100 |
commit | a1581742171fb3fdc8acae41998774a93c8161d6 (patch) | |
tree | e9d7a5fad057074a120c0bd5561ac8543c9a1178 /openpgp-ffi/src | |
parent | 2506b6aa85ca3e691e3fa97bd94d264bbc0d1b13 (diff) |
openpgp-ffi: Implement From<Fallible<T>> for Status.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/error.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/openpgp-ffi/src/error.rs b/openpgp-ffi/src/error.rs index f4d2f5b5..07b79a77 100644 --- a/openpgp-ffi/src/error.rs +++ b/openpgp-ffi/src/error.rs @@ -16,6 +16,15 @@ use RefRaw; #[::ffi_wrapper_type(prefix = "pgp_", derive = "Display")] pub struct Error(failure::Error); +impl<T> From<failure::Fallible<T>> for Status { + fn from(f: failure::Fallible<T>) -> ::error::Status { + match f { + Ok(_) => ::error::Status::Success, + Err(e) => ::error::Status::from(&e), + } + } +} + impl ::MoveResultIntoRaw<::error::Status> for ::failure::Fallible<()> { fn move_into_raw(self, errp: Option<&mut *mut ::error::Error>) |