summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorAaron Rennow <arennow@outlook.com>2021-03-27 14:25:52 -0400
committerAaron Rennow <arennow@outlook.com>2021-05-21 21:53:03 -0400
commitbc45e474a0e871dc2d28abdc75d68d84c5249a8c (patch)
tree168a3d1ecc9017236c9ecee2e69713e139aae203 /library/std/src/sys
parent5dc8789e300930751a78996da0fa906be5a344a2 (diff)
downloadrust-bc45e474a0e871dc2d28abdc75d68d84c5249a8c.tar.gz
rust-bc45e474a0e871dc2d28abdc75d68d84c5249a8c.zip
Add std::os::unix::fs::DirEntryExt2::file_name_ref(&self) -> &OsStr
DirEntryExt2 is a new trait with the same purpose as DirEntryExt,
but sealed
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/unix/fs.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs
index ef14865fbcd..eae156bff41 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -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 {