aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 75a5788..ec5b5b3 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -1,5 +1,6 @@
use std::{
ffi,
+ path,
str,
};
@@ -18,9 +19,10 @@ pub trait ToCString {
fn to_cstring(&self) -> Result<ffi::CString, ffi::NulError>;
}
-impl<T: ffi::AsOsStr> ToCString for T {
+impl<T: AsRef<path::Path>> ToCString for T {
fn to_cstring(&self) -> Result<ffi::CString, ffi::NulError> {
- self.as_os_str().to_cstring()
+ let path: &ffi::OsStr = self.as_ref().as_ref();
+ path.to_cstring()
}
}