Add missing links and examples for FileExt#45631
Conversation
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
[00:03:41] tidy error: /checkout/src/libstd/sys/unix/ext/fs.rs:90: trailing whitespace
09c501f to
376f8dc
Compare
|
Updated. |
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
What do you think about adding ? at the end of the method call instead of ignoring the result?
There was a problem hiding this comment.
I could just remove the ';'.
376f8dc to
8382304
Compare
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
Broken link, needs one more ../.
[01:13:11] std/os/unix/fs/trait.FileExt.html:70: broken link - std/std/fs/struct.File.html
[01:13:11] std/os/unix/fs/trait.FileExt.html:95: broken link - std/std/fs/struct.File.html
[01:13:20] thread 'main' panicked at 'found some broken links', /checkout/src/tools/linkchecker/main.rs:49:8
[01:13:20] note: Run with `RUST_BACKTRACE=1` for a backtrace.
8382304 to
8892230
Compare
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
This will only read up to 8 bytes so I think it's important to do something with the value read_at returns in this example. The same goes for write_at.
There was a problem hiding this comment.
maybe something like this?
// Read up to 8 bytes from the offset 10.
let num_bytes_read = file.read_at(buf, 10)?;
println!("read {} bytes: {:?}", num_bytes_read, buf);|
r? @frewsxcv |
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
Can you make this let mut buf = [0u8; 8]; and pass &mut buf to read_at? That way it'll match what we have in std::io::Read.
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
Why did you use read.v instead of method.read? I know they go to the same spot but i'm more used to reading the method. style link anchors. (Same for write farther down.)
There was a problem hiding this comment.
It's not targetting the same thing actually. :)
frewsxcv
left a comment
There was a problem hiding this comment.
r=me with @QuietMisdreavus's and @ollie27's comments addressed
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
maybe something like this?
// Read up to 8 bytes from the offset 10.
let num_bytes_read = file.read_at(buf, 10)?;
println!("read {} bytes: {:?}", num_bytes_read, buf);8892230 to
062705d
Compare
src/libstd/sys/unix/ext/fs.rs
Outdated
There was a problem hiding this comment.
this is not guaranteed to read 8 bytes, so phrasing it as 'up to 8 bytes' is a bit more accurate
062705d to
7035a25
Compare
|
☔ The latest upstream changes (presumably #45862) made this pull request unmergeable. Please resolve the merge conflicts. |
|
r=me with merge conflicts addressed |
7035a25 to
c09adc4
Compare
|
@bors: r=frewsxcv rollup |
|
📌 Commit c09adc4 has been approved by |
…wsxcv Add missing links and examples for FileExt r? @rust-lang/docs

r? @rust-lang/docs