Skip to content

Commit

Permalink
Add a better introduction for the io module.
Browse files Browse the repository at this point in the history
Let's actually give a top-level description of what's in here, eh?
  • Loading branch information
steveklabnik committed May 20, 2013
1 parent 9f67169 commit b1e8056
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/libcore/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

This comment has been minimized.

Copy link
@kud1ing

kud1ing May 21, 2013

I think we need to add an example for "using a Reader as a ReaderUtil".
For example trying to use a read_line on a BytesReader

`<T: Reader>`, 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.
*/

Expand Down

0 comments on commit b1e8056

Please sign in to comment.