From 01ae978db0dc8620b2cc754c0d5cf94a68c1f549 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 4 Nov 2016 16:32:20 -0700 Subject: Get rid of Ref There's unfortunately a rustdoc bug that causes all methods implemented for any Ref to be inlined in the deref methods section :( --- openssl/src/lib.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'openssl/src/lib.rs') diff --git a/openssl/src/lib.rs b/openssl/src/lib.rs index 785ffb39..183bf495 100644 --- a/openssl/src/lib.rs +++ b/openssl/src/lib.rs @@ -21,19 +21,16 @@ use libc::c_int; use error::ErrorStack; macro_rules! type_ { - ($n:ident, $c:path, $d:path) => { + ($n:ident, $r:ident, $c:path, $d:path) => { pub struct $n(*mut $c); - unsafe impl ::types::OpenSslType for $n { + impl ::types::OpenSslType for $n { type CType = $c; + type Ref = $r; unsafe fn from_ptr(ptr: *mut $c) -> $n { $n(ptr) } - - fn as_ptr(&self) -> *mut $c { - self.0 - } } impl Drop for $n { @@ -43,18 +40,24 @@ macro_rules! type_ { } impl ::std::ops::Deref for $n { - type Target = ::types::Ref<$n>; + type Target = $r; - fn deref(&self) -> &::types::Ref<$n> { - unsafe { ::types::Ref::from_ptr(self.0) } + fn deref(&self) -> &$r { + unsafe { ::types::OpenSslTypeRef::from_ptr(self.0) } } } impl ::std::ops::DerefMut for $n { - fn deref_mut(&mut self) -> &mut ::types::Ref<$n> { - unsafe { ::types::Ref::from_ptr_mut(self.0) } + fn deref_mut(&mut self) -> &mut $r { + unsafe { ::types::OpenSslTypeRef::from_ptr_mut(self.0) } } } + + pub struct $r(::util::Opaque); + + impl ::types::OpenSslTypeRef for $r { + type CType = $c; + } } } -- cgit v1.2.3