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();

    println!("{}", permissions.mode());
    println!("{:b}", permissions.mode());
    
    std::fs::set_permissions("foo.txt", PermissionsExt::from_mode(0o755))?;
    Ok(())
}
