From b1e805694b914613ec30619764bec961e78bbbac Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Sun, 19 May 2013 18:59:21 -0700 Subject: [PATCH 1/2] Add a better introduction for the io module. Let's actually give a top-level description of what's in here, eh? --- src/libcore/io.rs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 77b486ca44619..d23f2fa7e2c75 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -10,7 +10,37 @@ /*! -Basic input/output +The `io` module contains basic input and output routines. + +A quick summary: + +## `Reader` and `Writer` traits + +These traits define the simplest amount of methods that anything that can do +input and output should implement. + +## `ReaderUtil` and `WriterUtil` traits + +Richer methods that allow you to do more. `Reader` only lets you read a certain +amount of bytes into a buffer, while `ReaderUtil` allows you to read a whole +line, for example. + +Generally, these richer methods are probably the ones you want to actually +use in day-to-day Rust. + +Furthermore, because there is an implementation of `ReaderUtil` for +``, when your input or output code implements `Reader`, you get +all of these methods for free. + +## `print` and `println` + +These very useful functions are defined here. You generally don't need to +import them, though, as the prelude already does. + +## `stdin`, `stdout`, and `stderr` + +These functions return references to the classic three file descriptors. They +implement `Reader` and `Writer`, where appropriate. */ From 91d3e7f1a0757bf314ab3a4c4be8f910e2355d35 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Sun, 19 May 2013 20:39:02 -0600 Subject: [PATCH 2/2] Fix wording per feedback Thanks @catamorphism! --- src/libcore/io.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/io.rs b/src/libcore/io.rs index d23f2fa7e2c75..ffb49177b64f2 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -16,13 +16,13 @@ A quick summary: ## `Reader` and `Writer` traits -These traits define the simplest amount of methods that anything that can do +These traits define the minimal set of methods that anything that can do input and output should implement. ## `ReaderUtil` and `WriterUtil` traits Richer methods that allow you to do more. `Reader` only lets you read a certain -amount of bytes into a buffer, while `ReaderUtil` allows you to read a whole +number of bytes into a buffer, while `ReaderUtil` allows you to read a whole line, for example. Generally, these richer methods are probably the ones you want to actually