libmount 0.1.15

The type-safe wrapper around mount system call
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::path::Path;
use std::ffi::{CStr, CString, OsStr};
use std::os::unix::ffi::OsStrExt;


pub fn path_to_cstring(path: &Path) -> CString {
    return CString::new(path.as_os_str().as_bytes()).unwrap()
}

pub fn as_path(cstring: &CStr) -> &Path {
    OsStr::from_bytes(cstring.to_bytes()).as_ref()
}