-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul examples for PermissionsExt #136001
base: master
Are you sure you want to change the base?
Conversation
library/std/src/os/unix/fs.rs
Outdated
/// ); | ||
/// | ||
/// // file mode that we want to add in | ||
/// let my_mode = 0o007; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have your octets reversed -- this is world RWX, but you say owner below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely wrong indeed. Will fix.
/// | ||
/// permissions.set_mode(0o644); // Read/write for owner and read for others. | ||
/// assert_eq!(permissions.mode(), 0o644); | ||
/// Ok(()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I think I prefer the original tighter examples. Can we just add f.set_permissions(..)?;
here to solve the #91707 confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've uplifted one of the small examples, which now also shows use of all three methods, but without a file in sight, so no confusion with file.set_permissions is possible. Best of both worlds?
@rustbot labels: +A-docs |
This comment has been minimized.
This comment has been minimized.
This fixes rust-lang#91707 by including one overarching example, instead of the small examples that can be misleading.
This fixes #91707 by including one overarching example, instead of the small examples that can be misleading.