std: Expose a mode
accessor for Permissions on unix
Currently we have a `set_mode` mutator, so this just adds the pairing of a `mode` accessor to read the value. Closes #22738
This commit is contained in:
parent
91a5a1ab4a
commit
537d6946e4
3 changed files with 8 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue