Remove Opaque

This commit is contained in:
Steven Fackler 2016-10-31 20:56:51 -07:00
parent cd7fa9fca2
commit 96a77cf5a8
3 changed files with 2 additions and 10 deletions

View File

@ -59,7 +59,6 @@ macro_rules! type_ {
}
mod bio;
mod opaque;
mod util;
pub mod asn1;
pub mod bn;

View File

@ -1,6 +0,0 @@
use std::cell::UnsafeCell;
/// This is intended to be used as the inner type for types designed to be pointed to by references
/// converted from raw C pointers. It has an `UnsafeCell` internally to inform the compiler about
/// aliasability and doesn't implement `Copy`, so it can't be dereferenced.
pub struct Opaque(UnsafeCell<()>);

View File

@ -1,7 +1,6 @@
use std::cell::UnsafeCell;
use std::marker::PhantomData;
use opaque::Opaque;
pub unsafe trait OpenSslType {
type CType;
@ -10,7 +9,7 @@ pub unsafe trait OpenSslType {
fn as_ptr(&self) -> *mut Self::CType;
}
pub struct Ref<T>(Opaque, PhantomData<T>);
pub struct Ref<T>(UnsafeCell<()>, PhantomData<T>);
impl<T: OpenSslType> Ref<T> {
pub unsafe fn from_ptr<'a>(ptr: *mut T::CType) -> &'a Ref<T> {