aboutsummaryrefslogtreecommitdiffstats
path: root/src/ffi.rs
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2019-11-16 11:14:10 +0100
committerDirk Van Haerenborgh <vhdirk@gmail.com>2019-11-16 11:14:10 +0100
commite16769c9b16223c491766f9c9b2c828ee2253ed4 (patch)
treed1a6e68acc5bbb14d9f1e6bf65d7549916ff95b9 /src/ffi.rs
parent084675fdfe1329cbd58a48f2306b7c61dec08834 (diff)
downloadmail-e16769c9b16223c491766f9c9b2c828ee2253ed4.tar.gz
less unwraps
Diffstat (limited to 'src/ffi.rs')
-rw-r--r--src/ffi.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
index 285aeba..5c276d8 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -6,7 +6,7 @@ use libc::{c_char, c_double, c_int, c_uint, c_ulong, c_void, time_t};
use error::{Error, Result};
use std::{error, fmt, str};
-
+use std::borrow::Cow;
use utils::ToStr;
notmuch_enum! {
@@ -57,6 +57,14 @@ impl ToStr for Status {
fn to_str<'a>(&self) -> std::result::Result<&'a str, str::Utf8Error> {
unsafe { notmuch_status_to_string((*self).into()) }.to_str()
}
+
+ fn to_str_unchecked<'a>(&self) -> &'a str {
+ unsafe { notmuch_status_to_string((*self).into()) }.to_str_unchecked()
+ }
+
+ fn to_string_lossy<'a>(&self) -> Cow<'a, str> {
+ unsafe { notmuch_status_to_string((*self).into()) }.to_string_lossy()
+ }
}
impl fmt::Display for Status {