Skip to content

Commit ee62738

Browse files
committed
std_misc/process/pipe: Update comments to match current API.
1 parent 19e4cdd commit ee62738

File tree

1 file changed

+4
-4
lines changed
  • examples/std_misc/process/pipe

1 file changed

+4
-4
lines changed

examples/std_misc/process/pipe/pipe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ fn main() {
1616
};
1717

1818
{
19-
// Write a string to the stdin of `wc`
19+
// Write a string to the stdin of `wc`.
20+
// stdin has type `Option<ChildStdin>`, but since we know this instance
21+
// must have one, we can directly `unwrap` it.
2022
match process.stdin.unwrap().write_all(PANGRAM.as_bytes()) {
2123
Err(why) => panic!("couldn't write to wc stdin: {}",
2224
Error::description(&why)),
@@ -28,9 +30,7 @@ fn main() {
2830
// input we just sent
2931
}
3032

31-
// The `stdout` field also has type `Option<PipeStream>`
32-
// the `as_mut` method will return a mutable reference to the value
33-
// wrapped in a `Some` variant
33+
// The `stdout` field also has type `Option<ChildStdout>` so must be unwrapped.
3434
let mut s = String::new();
3535
match process.stdout.unwrap().read_to_string(&mut s) {
3636
Err(why) => panic!("couldn't read wc stdout: {}",

0 commit comments

Comments
 (0)