From 2506b6aa85ca3e691e3fa97bd94d264bbc0d1b13 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 25 Mar 2019 14:15:28 +0100 Subject: ffi-macros: Implement MoveFromRaw>. --- ffi-macros/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ffi-macros') 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> 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() { -- cgit v1.2.3