Skip to content

Commit 8f10d66

Browse files
committed
Rollup merge of #37089 - GuillaumeGomez:io_urls, r=frewsxcv
Add missing urls in io module r? @steveklabnik
2 parents 2099182 + b5bedfc commit 8f10d66

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

src/libstd/io/mod.rs

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@
1212
//!
1313
//! The `std::io` module contains a number of common things you'll need
1414
//! when doing input and output. The most core part of this module is
15-
//! the [`Read`][read] and [`Write`][write] traits, which provide the
15+
//! the [`Read`] and [`Write`] traits, which provide the
1616
//! most general interface for reading and writing input and output.
1717
//!
18-
//! [read]: trait.Read.html
19-
//! [write]: trait.Write.html
20-
//!
2118
//! # Read and Write
2219
//!
23-
//! Because they are traits, `Read` and `Write` are implemented by a number
20+
//! Because they are traits, [`Read`] and [`Write`] are implemented by a number
2421
//! of other types, and you can implement them for your types too. As such,
2522
//! you'll see a few different types of I/O throughout the documentation in
26-
//! this module: `File`s, `TcpStream`s, and sometimes even `Vec<T>`s. For
23+
//! this module: [`File`]s, [`TcpStream`]s, and sometimes even [`Vec<T>`]s. For
2724
//! example, `Read` adds a `read()` method, which we can use on `File`s:
2825
//!
2926
//! ```
@@ -43,15 +40,15 @@
4340
//! # }
4441
//! ```
4542
//!
46-
//! `Read` and `Write` are so important, implementors of the two traits have a
43+
//! [`Read`] and [`Write`] are so important, implementors of the two traits have a
4744
//! nickname: readers and writers. So you'll sometimes see 'a reader' instead
48-
//! of 'a type that implements the `Read` trait'. Much easier!
45+
//! of 'a type that implements the [`Read`] trait'. Much easier!
4946
//!
5047
//! ## Seek and BufRead
5148
//!
52-
//! Beyond that, there are two important traits that are provided: [`Seek`][seek]
53-
//! and [`BufRead`][bufread]. Both of these build on top of a reader to control
54-
//! how the reading happens. `Seek` lets you control where the next byte is
49+
//! Beyond that, there are two important traits that are provided: [`Seek`]
50+
//! and [`BufRead`]. Both of these build on top of a reader to control
51+
//! how the reading happens. [`Seek`] lets you control where the next byte is
5552
//! coming from:
5653
//!
5754
//! ```
@@ -75,21 +72,18 @@
7572
//! # }
7673
//! ```
7774
//!
78-
//! [seek]: trait.Seek.html
79-
//! [bufread]: trait.BufRead.html
80-
//!
81-
//! `BufRead` uses an internal buffer to provide a number of other ways to read, but
75+
//! [`BufRead`] uses an internal buffer to provide a number of other ways to read, but
8276
//! to show it off, we'll need to talk about buffers in general. Keep reading!
8377
//!
8478
//! ## BufReader and BufWriter
8579
//!
8680
//! Byte-based interfaces are unwieldy and can be inefficient, as we'd need to be
8781
//! making near-constant calls to the operating system. To help with this,
88-
//! `std::io` comes with two structs, `BufReader` and `BufWriter`, which wrap
82+
//! `std::io` comes with two structs, [`BufReader`] and [`BufWriter`], which wrap
8983
//! readers and writers. The wrapper uses a buffer, reducing the number of
9084
//! calls and providing nicer methods for accessing exactly what you want.
9185
//!
92-
//! For example, `BufReader` works with the `BufRead` trait to add extra
86+
//! For example, [`BufReader`] works with the [`BufRead`] trait to add extra
9387
//! methods to any reader:
9488
//!
9589
//! ```
@@ -111,8 +105,8 @@
111105
//! # }
112106
//! ```
113107
//!
114-
//! `BufWriter` doesn't add any new ways of writing; it just buffers every call
115-
//! to [`write()`][write()]:
108+
//! [`BufWriter`] doesn't add any new ways of writing; it just buffers every call
109+
//! to [`write()`]:
116110
//!
117111
//! ```
118112
//! use std::io;
@@ -134,8 +128,6 @@
134128
//! # }
135129
//! ```
136130
//!
137-
//! [write()]: trait.Write.html#tymethod.write
138-
//!
139131
//! ## Standard input and output
140132
//!
141133
//! A very common source of input is standard input:
@@ -165,13 +157,13 @@
165157
//! # }
166158
//! ```
167159
//!
168-
//! Of course, using `io::stdout()` directly is less common than something like
169-
//! `println!`.
160+
//! Of course, using [`io::stdout()`] directly is less common than something like
161+
//! [`println!`].
170162
//!
171163
//! ## Iterator types
172164
//!
173165
//! A large number of the structures provided by `std::io` are for various
174-
//! ways of iterating over I/O. For example, `Lines` is used to split over
166+
//! ways of iterating over I/O. For example, [`Lines`] is used to split over
175167
//! lines:
176168
//!
177169
//! ```
@@ -211,10 +203,10 @@
211203
//!
212204
//! ## io::Result
213205
//!
214-
//! Last, but certainly not least, is [`io::Result`][result]. This type is used
206+
//! Last, but certainly not least, is [`io::Result`]. This type is used
215207
//! as the return type of many `std::io` functions that can cause an error, and
216208
//! can be returned from your own functions as well. Many of the examples in this
217-
//! module use the [`try!`][try] macro:
209+
//! module use the [`try!`] macro:
218210
//!
219211
//! ```
220212
//! use std::io;
@@ -230,14 +222,11 @@
230222
//! }
231223
//! ```
232224
//!
233-
//! The return type of `read_input()`, `io::Result<()>`, is a very common type
234-
//! for functions which don't have a 'real' return value, but do want to return
235-
//! errors if they happen. In this case, the only purpose of this function is
225+
//! The return type of `read_input()`, [`io::Result<()>`][`io::Result`], is a very
226+
//! common type for functions which don't have a 'real' return value, but do want to
227+
//! return errors if they happen. In this case, the only purpose of this function is
236228
//! to read the line and print it, so we use `()`.
237229
//!
238-
//! [result]: type.Result.html
239-
//! [try]: ../macro.try.html
240-
//!
241230
//! ## Platform-specific behavior
242231
//!
243232
//! Many I/O functions throughout the standard library are documented to indicate
@@ -246,6 +235,22 @@
246235
//! any possibly unclear semantics. Note, however, that this is informative, not a binding
247236
//! contract. The implementation of many of these functions are subject to change over
248237
//! time and may call fewer or more syscalls/library functions.
238+
//!
239+
//! [`Read`]: trait.Read.html
240+
//! [`Write`]: trait.Write.html
241+
//! [`Seek`]: trait.Seek.html
242+
//! [`BufRead`]: trait.BufRead.html
243+
//! [`File`]: ../fs/struct.File.html
244+
//! [`TcpStream`]: ../net/struct.TcpStream.html
245+
//! [`Vec<T>`]: ../vec/struct.Vec.html
246+
//! [`BufReader`]: struct.BufReader.html
247+
//! [`BufWriter`]: struct.BufWriter.html
248+
//! [`write()`]: trait.Write.html#tymethod.write
249+
//! [`io::stdout()`]: fn.stdout.html
250+
//! [`println!`]: ../macro.println.html
251+
//! [`Lines`]: struct.Lines.html
252+
//! [`io::Result`]: type.Result.html
253+
//! [`try!`]: ../macro.try.html
249254
250255
#![stable(feature = "rust1", since = "1.0.0")]
251256

0 commit comments

Comments
 (0)