pub trait PermissionsExt { fn mode(&self) -> u32; fn set_mode(&mut self, mode: u32); fn from_mode(mode: u32) -> Self; }
Unix-specific extensions to fs::Permissions
.
fn mode(&self) -> u32
Returns the underlying raw st_mode
bits that contain the standard Unix permissions for this file.
fn set_mode(&mut self, mode: u32)
Sets the underlying raw bits for this set of permissions.
use std::fs::File; use std::os::unix::fs::PermissionsExt; fn main() -> std::io::Result<()> { let f = File::create("foo.txt")?; let metadata = f.metadata()?; let mut permissions = metadata.permissions(); permissions.set_mode(0o644); // Read/write for owner and read for others. assert_eq!(permissions.mode(), 0o644); Ok(()) }
fn from_mode(mode: u32) -> Self
impl PermissionsExt for Permissions
[src]
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/unix/fs/trait.PermissionsExt.html