summaryrefslogtreecommitdiffstats
path: root/ffi-macros
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-03-25 14:15:28 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-03-25 16:54:11 +0100
commit2506b6aa85ca3e691e3fa97bd94d264bbc0d1b13 (patch)
treeac0bfefb630201bd3bfb8a92ad303d01863c252a /ffi-macros
parent5d7d51ef0d8a40f230567b8c33e92b6bceded1a9 (diff)
ffi-macros: Implement MoveFromRaw<Option<W>>.
Diffstat (limited to 'ffi-macros')
-rw-r--r--ffi-macros/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/ffi-macros/src/lib.rs b/ffi-macros/src/lib.rs
index 6f1ce312..4ebea637 100644
--- a/ffi-macros/src/lib.rs
+++ b/ffi-macros/src/lib.rs
@@ -406,6 +406,14 @@ fn derive_conversion_functions(mut st: syn::ItemStruct,
}
}
+ impl ::MoveFromRaw<Option<#wrapped>> for
+ Option<::std::ptr::NonNull<#wrapper>>
+ {
+ fn move_from_raw(self) -> Option<#wrapped> {
+ self.map(|nn| nn.as_ptr().move_from_raw())
+ }
+ }
+
impl ::RefRaw<#wrapped> for *const #wrapper {
fn ref_raw(self) -> &'static #wrapped {
if self.is_null() {