about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-02-25 10:30:01 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-02-25 10:30:01 +0530
commit1f2b3ebd7bef3b7c8df18c618d9bd3e3a5a7c491 (patch)
treeecc88830c366240d45ab309b42e9f54078d90d0c /src/libstd/sys
parentecaf74ab3b8f67e9b5fe74c34c1beee71a22da88 (diff)
parent537d6946e4570a9425aa5c881454e67bedf210b0 (diff)
downloadrust-1f2b3ebd7bef3b7c8df18c618d9bd3e3a5a7c491.tar.gz
rust-1f2b3ebd7bef3b7c8df18c618d9bd3e3a5a7c491.zip
Rollup merge of #22744 - alexcrichton:issue-22738, r=aturon
 Currently we have a `set_mode` mutator, so this just adds the pairing of a
`mode` accessor to read the value.

Closes #22738
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/unix/ext.rs3
-rw-r--r--src/libstd/sys/unix/fs2.rs1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/ext.rs b/src/libstd/sys/unix/ext.rs
index b8b9dcfb3c6..3f9da6e3c51 100644
--- a/src/libstd/sys/unix/ext.rs
+++ b/src/libstd/sys/unix/ext.rs
@@ -173,10 +173,13 @@ impl OsStrExt for OsStr {
 
 // Unix-specific extensions to `Permissions`
 pub trait PermissionsExt {
+    fn mode(&self) -> i32;
     fn set_mode(&mut self, mode: i32);
 }
 
 impl PermissionsExt for Permissions {
+    fn mode(&self) -> i32 { self.as_inner().mode() }
+
     fn set_mode(&mut self, mode: i32) {
         *self = FromInner::from_inner(FromInner::from_inner(mode));
     }
diff --git a/src/libstd/sys/unix/fs2.rs b/src/libstd/sys/unix/fs2.rs
index c6b9c2cba52..72e0b8dd36c 100644
--- a/src/libstd/sys/unix/fs2.rs
+++ b/src/libstd/sys/unix/fs2.rs
@@ -90,6 +90,7 @@ impl FilePermissions {
             self.mode |= 0o222;
         }
     }
+    pub fn mode(&self) -> i32 { self.mode as i32 }
 }
 
 impl FromInner<i32> for FilePermissions {