use std::ffi::OsStr;
pub trait OsStrExt {
fn try_as_bytes(&self) -> Option<&[u8]>;
}
impl OsStrExt for OsStr {
#[inline]
fn try_as_bytes(&self) -> Option<&[u8]> {
#[cfg(unix)] {
use std::os::unix::ffi::OsStrExt;
Some(self.as_bytes())
}
#[cfg(not(unix))] {
s.to_str().map(|s| s.as_bytes())
}
}
}