diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-02-25 10:30:01 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-02-25 10:30:01 +0530 |
| commit | 1f2b3ebd7bef3b7c8df18c618d9bd3e3a5a7c491 (patch) | |
| tree | ecc88830c366240d45ab309b42e9f54078d90d0c /src/libstd/sys | |
| parent | ecaf74ab3b8f67e9b5fe74c34c1beee71a22da88 (diff) | |
| parent | 537d6946e4570a9425aa5c881454e67bedf210b0 (diff) | |
| download | rust-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.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/fs2.rs | 1 |
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 { |
