aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/lib.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-11-04 16:32:20 -0700
committerSteven Fackler <[email protected]>2016-11-04 17:16:59 -0700
commit01ae978db0dc8620b2cc754c0d5cf94a68c1f549 (patch)
treebc9a3bc83a1efe4853628a1c56eca8af75e079c9 /openssl/src/lib.rs
parentMake utility functions private (diff)
downloadrust-openssl-01ae978db0dc8620b2cc754c0d5cf94a68c1f549.tar.xz
rust-openssl-01ae978db0dc8620b2cc754c0d5cf94a68c1f549.zip
Get rid of Ref
There's unfortunately a rustdoc bug that causes all methods implemented for any Ref<T> to be inlined in the deref methods section :(
Diffstat (limited to 'openssl/src/lib.rs')
-rw-r--r--openssl/src/lib.rs25
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;
+ }
}
}