Commit 96a77cf5 authored by Steven Fackler's avatar Steven Fackler
Browse files

Remove Opaque

parent cd7fa9fc
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ macro_rules! type_ {
}

mod bio;
mod opaque;
mod util;
pub mod asn1;
pub mod bn;

openssl/src/opaque.rs

deleted100644 → 0
+0 −6
Original line number Diff line number Diff line
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<()>);
+2 −3
Original line number Diff line number Diff line
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> {