summaryrefslogtreecommitdiffstats
path: root/ffi-macros
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-02-12 14:18:15 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-02-12 14:24:24 +0100
commite50d67381e4eeeeafea3c06d37361ab47021a58f (patch)
treeb386f7db0453d7bf2337b9632d03bcae4ca8c581 /ffi-macros
parentd795d29a203a5d0b1a409063c720e2583c26b3e2 (diff)
openpgp-ffi: Improve derived functions.
- Explicitly use the Parse and Serialize traits so that the modules that derives these functions do not have to use them explicitly.
Diffstat (limited to 'ffi-macros')
-rw-r--r--ffi-macros/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/ffi-macros/src/lib.rs b/ffi-macros/src/lib.rs
index 8a3a39f1..15027dd5 100644
--- a/ffi-macros/src/lib.rs
+++ b/ffi-macros/src/lib.rs
@@ -732,6 +732,7 @@ fn derive_parse(span: proc_macro2::Span, prefix: &str, name: &str,
fn #from_reader(errp: Option<&mut *mut ::error::Error>,
reader: *mut super::io::Reader)
-> ::Maybe<#wrapper> {
+ use ::sequoia_openpgp::parse::Parse;
use ::RefMutRaw;
use ::MoveResultIntoRaw;
#wrapped::from_reader(reader.ref_mut_raw()).move_into_raw(errp)
@@ -742,6 +743,7 @@ fn derive_parse(span: proc_macro2::Span, prefix: &str, name: &str,
fn #from_file(errp: Option<&mut *mut ::error::Error>,
filename: *const ::libc::c_char)
-> ::Maybe<#wrapper> {
+ use ::sequoia_openpgp::parse::Parse;
use ::MoveResultIntoRaw;
let filename =
ffi_param_cstr!(filename).to_string_lossy().into_owned();
@@ -753,6 +755,7 @@ fn derive_parse(span: proc_macro2::Span, prefix: &str, name: &str,
fn #from_bytes(errp: Option<&mut *mut ::error::Error>,
b: *const ::libc::uint8_t, len: ::libc::size_t)
-> ::Maybe<#wrapper> {
+ use ::sequoia_openpgp::parse::Parse;
use ::MoveResultIntoRaw;
assert!(!b.is_null());
let buf = unsafe {
@@ -778,6 +781,7 @@ fn derive_serialize(span: proc_macro2::Span, prefix: &str, name: &str,
this: *const #wrapper,
writer: *mut super::io::Writer)
-> ::error::Status {
+ use ::sequoia_openpgp::serialize::Serialize;
use ::RefRaw;
use ::RefMutRaw;
use ::MoveResultIntoRaw;