Add std::os::unix::fs::DirEntryExt2::file_name_ref(&self) -> &OsStr

DirEntryExt2 is a new trait with the same purpose as DirEntryExt,
but sealed
This commit is contained in:
Aaron Rennow
2021-03-27 14:25:52 -04:00
parent 5dc8789e30
commit bc45e474a0
2 changed files with 42 additions and 0 deletions

View File

@@ -647,6 +647,10 @@ impl DirEntry {
fn name_bytes(&self) -> &[u8] {
&*self.name
}
pub fn file_name_os_str(&self) -> &OsStr {
OsStr::from_bytes(self.name_bytes())
}
}
impl OpenOptions {