diff options
| author | Steven Fackler <[email protected]> | 2015-05-17 11:22:42 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2015-05-17 11:22:42 -0700 |
| commit | 1123c7387ebb5036c3ac05893e7dbb1a70ddacce (patch) | |
| tree | f8641d5c57319e4bcd39e67a987dde239e6a3f51 /openssl/src | |
| parent | Merge pull request #213 from josephglanville/feature/read_subject (diff) | |
| download | rust-openssl-1123c7387ebb5036c3ac05893e7dbb1a70ddacce.tar.xz rust-openssl-1123c7387ebb5036c3ac05893e7dbb1a70ddacce.zip | |
Fix SslString Debug impl and drop lifetime
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/x509/mod.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 0f7585cc..4096f690 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -24,17 +24,17 @@ use nid; #[cfg(test)] mod tests; -pub struct SslString<'s> { - s : &'s str +pub struct SslString { + s : &'static str } -impl<'s> Drop for SslString<'s> { +impl<'s> Drop for SslString { fn drop(&mut self) { unsafe { ffi::CRYPTO_free(self.s.as_ptr() as *mut c_void); } } } -impl<'s> Deref for SslString<'s> { +impl Deref for SslString { type Target = str; fn deref(&self) -> &str { @@ -42,23 +42,23 @@ impl<'s> Deref for SslString<'s> { } } -impl<'s> SslString<'s> { - pub unsafe fn new(buf: *const c_char) -> SslString<'s> { +impl SslString { + unsafe fn new(buf: *const c_char) -> SslString { SslString { s: str::from_utf8(CStr::from_ptr(buf).to_bytes()).unwrap() } } } -impl<'s> fmt::Display for SslString<'s> { +impl fmt::Display for SslString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self) + fmt::Display::fmt(self.s, f) } } -impl<'s> fmt::Debug for SslString<'s> { +impl fmt::Debug for SslString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self) + fmt::Debug::fmt(self.s, f) } } |