blob: a6e279af9c1c10223375914789900949be40c2a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use std::ffi::CString;
use std::path::Path;
pub trait ToCStr {
fn to_c_str(&self) -> CString;
}
impl ToCStr for Path {
fn to_c_str(&self) -> CString {
CString::from_slice(self.as_vec())
}
}
impl ToCStr for String {
fn to_c_str(&self) -> CString {
CString::from_slice(self.as_bytes())
}
}
|