/// Turns an AsRef<Path> into a CString (c style string).
/// The expect should not fail, since Linux paths only contain valid Unicode chars (do they?),
/// and do not contain null bytes (do they?).
Turns an AsRef into a CString (c style string).
The expect should not fail, since Linux paths only contain valid Unicode chars (do they?),
and do not contain null bytes (do they?).
Turns an AsRef into a CString ( c style string ) . The expect should not fail since Linux paths only contain valid Unicode chars ( do they? ) and do not contain null bytes ( do they? ) .
fn to_cstring<T: AsRef<Path>>(path: T) -> Result<CString> {
    let path_str = path
        .as_ref()
        .to_path_buf()
        .into_os_string()
        .into_string()
        .map_err(|e| Error::OsStringParsing(path.as_ref().to_path_buf(), e))?;
    CString::new(path_str).map_err(Error::CStringParsing)
}
fn to_cstring < T : AsRef < Path > > ( path : T ) -> Result < CString > { let path_str = path . as_ref ( ) . to_path_buf ( ) . into_os_string ( ) . into_string ( ) . map_err ( | e | Error :: OsStringParsing ( path . as_ref ( ) . to_path_buf ( ) , e ) ) ? ; CString :: new ( path_str ) . map_err ( Error :: CStringParsing ) }
Turns an AsRef<Path> into a CString (c style string).
Turns an AsRef<Path > into a CString ( c style string ) .
path
T