-
Notifications
You must be signed in to change notification settings - Fork 13k
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
add missing docs for MetadataExt #45470
Conversation
src/libstd/sys/unix/ext/fs.rs
Outdated
/// | ||
/// # Examples | ||
/// | ||
/// ``` |
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.
no_run
?
src/libstd/sys/unix/ext/fs.rs
Outdated
/// # Examples | ||
/// | ||
/// ``` | ||
/// # #[cfg(target_os = "linux")] { |
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.
This is in the unix
module, not linux
, so it would be more accurate to use cfg(unix)
here. (I would prefer not having this wrapper here at all, but if you're going to keep it then that's my suggestion.)
src/libstd/sys/unix/ext/fs.rs
Outdated
/// let user_has_write_access = mode & 0200; | ||
/// let user_has_read_write_access = mode & 0600; | ||
/// let group_has_read_access = mode & 0040; | ||
/// let others_have_exec_access = mode & 0001; |
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.
Pretty sure these should all be 0o200
etc? I didn't think rust had zero-prefix octal notation.
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.
Oh damn you're right! Bad assumption. :s
73e00f1
to
61cd798
Compare
Updated. |
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.
Sorry for letting this get stale! I have a couple more nits. You can take them or leave them.
src/libstd/sys/unix/ext/fs.rs
Outdated
#[stable(feature = "metadata_ext", since = "1.1.0")] | ||
fn blksize(&self) -> u64; | ||
/// Returns the number of 512 bytes blocks allocated. |
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.
Maybe "the number of blocks allocated to the file, in 512-byte units"? (This is what man 2 stat
says on my system. It also has an additional "This may be smaller than st_size/512 when the file has holes," which may also be worth including.)
src/libstd/sys/unix/ext/fs.rs
Outdated
/// | ||
/// ```no_run | ||
/// use std::fs; | ||
/// use std::os::unix::prelude::MetadataExt; |
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 feel like it would be better to grab the trait in its actual home of std::os::unix::fs::MetadataExt
, rather than pulling from the unix prelude? Since that's the page that these examples will be living on. >_>
61cd798
to
af1e4f6
Compare
Updated. |
@bors r+ rollup Thanks! |
📌 Commit af1e4f6 has been approved by |
…=QuietMisdreavus add missing docs for MetadataExt r? @rust-lang/docs
…=QuietMisdreavus add missing docs for MetadataExt r? @rust-lang/docs
r? @rust-lang/docs