diff options
| author | Steven Fackler <[email protected]> | 2016-11-04 18:40:43 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-11-04 18:40:43 -0700 |
| commit | 1108db74ec420f2042b44148ce86751e7b282b70 (patch) | |
| tree | bc9a3bc83a1efe4853628a1c56eca8af75e079c9 /openssl/src/lib.rs | |
| parent | Make utility functions private (diff) | |
| parent | Get rid of Ref (diff) | |
| download | rust-openssl-1108db74ec420f2042b44148ce86751e7b282b70.tar.xz rust-openssl-1108db74ec420f2042b44148ce86751e7b282b70.zip | |
Merge pull request #512 from sfackler/no-ref
Get rid of Ref
Diffstat (limited to 'openssl/src/lib.rs')
| -rw-r--r-- | openssl/src/lib.rs | 25 |
1 files changed, 14 insertions, 11 deletions
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; + } } } |