diff options
| -rw-r--r-- | src/ffi.rs | 3 | ||||
| -rw-r--r-- | src/utils.rs | 12 |
2 files changed, 1 insertions, 14 deletions
@@ -19,7 +19,6 @@ use std::{ use utils::{ NotmuchType, - ToStaticStr, ToStr, }; @@ -70,7 +69,7 @@ impl ToStr for NotmuchStatus { fn to_str<'a>(&self) -> Result<&'a str, str::Utf8Error> { unsafe { notmuch_status_to_string(self.to_notmuch_t()) - }.to_static_str() + }.to_str() } } diff --git a/src/utils.rs b/src/utils.rs index ad6cf9b..75a5788 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -35,15 +35,3 @@ impl ToStr for *const libc::c_char { }.to_bytes()) } } - -pub trait ToStaticStr { - fn to_static_str(&self) -> Result<&'static str, str::Utf8Error>; -} - -impl ToStaticStr for *const libc::c_char { - fn to_static_str(&self) -> Result<&'static str, str::Utf8Error> { - str::from_utf8(unsafe { - ffi::CStr::from_ptr(*self) - }.to_bytes()) - } -} |
