Function std::io::fs::chmod[src]
pub fn chmod(path: &Path, mode: FilePermission) -> IoResult<()>
Changes the permission mode bits found on a file or a directory. This
function takes a mask from the io module
Example
fn main() { #![allow(unused_must_use)] use std::io; use std::io::fs; fs::chmod(&Path::new("file.txt"), io::UserFile); fs::chmod(&Path::new("file.txt"), io::UserRead | io::UserWrite); fs::chmod(&Path::new("dir"), io::UserDir); fs::chmod(&Path::new("file.exe"), io::UserExec); }use std::io; use std::io::fs; fs::chmod(&Path::new("file.txt"), io::UserFile); fs::chmod(&Path::new("file.txt"), io::UserRead | io::UserWrite); fs::chmod(&Path::new("dir"), io::UserDir); fs::chmod(&Path::new("file.exe"), io::UserExec);
Error
If this function encounters an I/O error, it will return an Err value.
Some possible error situations are not having the permission to
change the attributes of a file or the file not existing.