diff options
| author | Steven Fackler <[email protected]> | 2017-02-04 08:54:25 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-02-04 08:54:25 -0800 |
| commit | 084cf3c66b7cc3d24cb23d2bb548fa0fa4ee040a (patch) | |
| tree | 6c3e0f158d3cf63e5ae8229126e3430847398ad3 /openssl/src/asn1.rs | |
| parent | Merge pull request #571 from sfackler/build-script-cleanup (diff) | |
| parent | Switch to foreign_types (diff) | |
| download | rust-openssl-084cf3c66b7cc3d24cb23d2bb548fa0fa4ee040a.tar.xz rust-openssl-084cf3c66b7cc3d24cb23d2bb548fa0fa4ee040a.zip | |
Merge pull request #572 from sfackler/foreign-types
Switch to foreign_types
Diffstat (limited to 'openssl/src/asn1.rs')
| -rw-r--r-- | openssl/src/asn1.rs | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/openssl/src/asn1.rs b/openssl/src/asn1.rs index d177885e..fd932723 100644 --- a/openssl/src/asn1.rs +++ b/openssl/src/asn1.rs @@ -1,4 +1,5 @@ use ffi; +use foreign_types::{ForeignType, ForeignTypeRef}; use libc::{c_long, c_char}; use std::fmt; use std::ptr; @@ -8,10 +9,15 @@ use std::str; use {cvt, cvt_p}; use bio::MemBio; use error::ErrorStack; -use types::{OpenSslType, OpenSslTypeRef}; use string::OpensslString; -type_!(Asn1GeneralizedTime, Asn1GeneralizedTimeRef, ffi::ASN1_GENERALIZEDTIME, ffi::ASN1_GENERALIZEDTIME_free); +foreign_type! { + type CType = ffi::ASN1_GENERALIZEDTIME; + fn drop = ffi::ASN1_GENERALIZEDTIME_free; + + pub struct Asn1GeneralizedTime; + pub struct Asn1GeneralizedTimeRef; +} impl fmt::Display for Asn1GeneralizedTimeRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -23,7 +29,13 @@ impl fmt::Display for Asn1GeneralizedTimeRef { } } -type_!(Asn1Time, Asn1TimeRef, ffi::ASN1_TIME, ffi::ASN1_TIME_free); +foreign_type! { + type CType = ffi::ASN1_TIME; + fn drop = ffi::ASN1_TIME_free; + + pub struct Asn1Time; + pub struct Asn1TimeRef; +} impl fmt::Display for Asn1TimeRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -51,7 +63,13 @@ impl Asn1Time { } } -type_!(Asn1String, Asn1StringRef, ffi::ASN1_STRING, ffi::ASN1_STRING_free); +foreign_type! { + type CType = ffi::ASN1_STRING; + fn drop = ffi::ASN1_STRING_free; + + pub struct Asn1String; + pub struct Asn1StringRef; +} impl Asn1StringRef { pub fn as_utf8(&self) -> Result<OpensslString, ErrorStack> { |