diff options
-rw-r--r-- | ffi-macros/src/lib.rs | 8 |
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() { |