Skip to content

Commit a41505f

Browse files
authored
Auto merge of #37259 - GuillaumeGomez:fix_io_urls, r=frewsxcv
Add more io urls r? @steveklabnik
2 parents 0c42987 + b12f63b commit a41505f

File tree

1 file changed

+52
-41
lines changed

1 file changed

+52
-41
lines changed

src/libstd/io/mod.rs

+52-41
Original file line numberDiff line numberDiff line change
@@ -1154,10 +1154,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
11541154
///
11551155
/// For example, reading line-by-line is inefficient without using a buffer, so
11561156
/// if you want to read by line, you'll need `BufRead`, which includes a
1157-
/// [`read_line()`][readline] method as well as a [`lines()`][lines] iterator.
1158-
///
1159-
/// [readline]: #method.read_line
1160-
/// [lines]: #method.lines
1157+
/// [`read_line()`] method as well as a [`lines()`] iterator.
11611158
///
11621159
/// # Examples
11631160
///
@@ -1173,14 +1170,17 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
11731170
/// }
11741171
/// ```
11751172
///
1176-
/// If you have something that implements `Read`, you can use the [`BufReader`
1177-
/// type][bufreader] to turn it into a `BufRead`.
1173+
/// If you have something that implements [`Read`], you can use the [`BufReader`
1174+
/// type][`BufReader`] to turn it into a `BufRead`.
11781175
///
1179-
/// For example, [`File`][file] implements `Read`, but not `BufRead`.
1180-
/// `BufReader` to the rescue!
1176+
/// For example, [`File`] implements [`Read`], but not `BufRead`.
1177+
/// [`BufReader`] to the rescue!
11811178
///
1182-
/// [bufreader]: struct.BufReader.html
1183-
/// [file]: ../fs/struct.File.html
1179+
/// [`BufReader`]: struct.BufReader.html
1180+
/// [`File`]: ../fs/struct.File.html
1181+
/// [`read_line()`]: #method.read_line
1182+
/// [`lines()`]: #method.lines
1183+
/// [`Read`]: trait.Read.html
11841184
///
11851185
/// ```
11861186
/// use std::io::{self, BufReader};
@@ -1204,13 +1204,13 @@ pub trait BufRead: Read {
12041204
/// Fills the internal buffer of this object, returning the buffer contents.
12051205
///
12061206
/// This function is a lower-level call. It needs to be paired with the
1207-
/// [`consume`][consume] method to function properly. When calling this
1207+
/// [`consume()`] method to function properly. When calling this
12081208
/// method, none of the contents will be "read" in the sense that later
1209-
/// calling `read` may return the same contents. As such, `consume` must be
1210-
/// called with the number of bytes that are consumed from this buffer to
1209+
/// calling `read` may return the same contents. As such, [`consume()`] must
1210+
/// be called with the number of bytes that are consumed from this buffer to
12111211
/// ensure that the bytes are never returned twice.
12121212
///
1213-
/// [consume]: #tymethod.consume
1213+
/// [`consume()`]: #tymethod.consume
12141214
///
12151215
/// An empty buffer returned indicates that the stream has reached EOF.
12161216
///
@@ -1251,21 +1251,21 @@ pub trait BufRead: Read {
12511251
/// so they should no longer be returned in calls to `read`.
12521252
///
12531253
/// This function is a lower-level call. It needs to be paired with the
1254-
/// [`fill_buf`][fillbuf] method to function properly. This function does
1254+
/// [`fill_buf()`] method to function properly. This function does
12551255
/// not perform any I/O, it simply informs this object that some amount of
1256-
/// its buffer, returned from `fill_buf`, has been consumed and should no
1257-
/// longer be returned. As such, this function may do odd things if
1258-
/// `fill_buf` isn't called before calling it.
1259-
///
1260-
/// [fillbuf]: #tymethod.fill_buf
1256+
/// its buffer, returned from [`fill_buf()`], has been consumed and should
1257+
/// no longer be returned. As such, this function may do odd things if
1258+
/// [`fill_buf()`] isn't called before calling it.
12611259
///
12621260
/// The `amt` must be `<=` the number of bytes in the buffer returned by
1263-
/// `fill_buf`.
1261+
/// [`fill_buf()`].
12641262
///
12651263
/// # Examples
12661264
///
1267-
/// Since `consume()` is meant to be used with [`fill_buf()`][fillbuf],
1265+
/// Since `consume()` is meant to be used with [`fill_buf()`],
12681266
/// that method's example includes an example of `consume()`.
1267+
///
1268+
/// [`fill_buf()`]: #tymethod.fill_buf
12691269
#[stable(feature = "rust1", since = "1.0.0")]
12701270
fn consume(&mut self, amt: usize);
12711271

@@ -1279,8 +1279,8 @@ pub trait BufRead: Read {
12791279
///
12801280
/// # Errors
12811281
///
1282-
/// This function will ignore all instances of `ErrorKind::Interrupted` and
1283-
/// will otherwise return any errors returned by `fill_buf`.
1282+
/// This function will ignore all instances of [`ErrorKind::Interrupted`] and
1283+
/// will otherwise return any errors returned by [`fill_buf()`].
12841284
///
12851285
/// If an I/O error is encountered then all bytes read so far will be
12861286
/// present in `buf` and its length will have been adjusted appropriately.
@@ -1290,6 +1290,9 @@ pub trait BufRead: Read {
12901290
/// A locked standard input implements `BufRead`. In this example, we'll
12911291
/// read from standard input until we see an `a` byte.
12921292
///
1293+
/// [`fill_buf()`]: #tymethod.fill_buf
1294+
/// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted
1295+
///
12931296
/// ```
12941297
/// use std::io;
12951298
/// use std::io::prelude::*;
@@ -1322,19 +1325,20 @@ pub trait BufRead: Read {
13221325
///
13231326
/// # Errors
13241327
///
1325-
/// This function has the same error semantics as `read_until` and will also
1326-
/// return an error if the read bytes are not valid UTF-8. If an I/O error
1327-
/// is encountered then `buf` may contain some bytes already read in the
1328-
/// event that all data read so far was valid UTF-8.
1328+
/// This function has the same error semantics as [`read_until()`] and will
1329+
/// also return an error if the read bytes are not valid UTF-8. If an I/O
1330+
/// error is encountered then `buf` may contain some bytes already read in
1331+
/// the event that all data read so far was valid UTF-8.
13291332
///
13301333
/// # Examples
13311334
///
13321335
/// A locked standard input implements `BufRead`. In this example, we'll
13331336
/// read all of the lines from standard input. If we were to do this in
1334-
/// an actual project, the [`lines()`][lines] method would be easier, of
1337+
/// an actual project, the [`lines()`] method would be easier, of
13351338
/// course.
13361339
///
1337-
/// [lines]: #method.lines
1340+
/// [`lines()`]: #method.lines
1341+
/// [`read_until()`]: #method.read_until
13381342
///
13391343
/// ```
13401344
/// use std::io;
@@ -1363,17 +1367,21 @@ pub trait BufRead: Read {
13631367
/// `byte`.
13641368
///
13651369
/// The iterator returned from this function will return instances of
1366-
/// `io::Result<Vec<u8>>`. Each vector returned will *not* have the
1367-
/// delimiter byte at the end.
1370+
/// [`io::Result`]`<`[`Vec<u8>`]`>`. Each vector returned will *not* have
1371+
/// the delimiter byte at the end.
13681372
///
1369-
/// This function will yield errors whenever `read_until` would have also
1370-
/// yielded an error.
1373+
/// This function will yield errors whenever [`read_until()`] would have
1374+
/// also yielded an error.
13711375
///
13721376
/// # Examples
13731377
///
13741378
/// A locked standard input implements `BufRead`. In this example, we'll
13751379
/// read some input from standard input, splitting on commas.
13761380
///
1381+
/// [`io::Result`]: type.Result.html
1382+
/// [`Vec<u8>`]: ../vec/struct.Vec.html
1383+
/// [`read_until()`]: #method.read_until
1384+
///
13771385
/// ```
13781386
/// use std::io;
13791387
/// use std::io::prelude::*;
@@ -1392,9 +1400,12 @@ pub trait BufRead: Read {
13921400
/// Returns an iterator over the lines of this reader.
13931401
///
13941402
/// The iterator returned from this function will yield instances of
1395-
/// `io::Result<String>`. Each string returned will *not* have a newline
1403+
/// [`io::Result`]`<`[`String`]`>`. Each string returned will *not* have a newline
13961404
/// byte (the 0xA byte) or CRLF (0xD, 0xA bytes) at the end.
13971405
///
1406+
/// [`io::Result`]: type.Result.html
1407+
/// [`String`]: ../string/struct.String.html
1408+
///
13981409
/// # Examples
13991410
///
14001411
/// A locked standard input implements `BufRead`:
@@ -1417,10 +1428,10 @@ pub trait BufRead: Read {
14171428

14181429
/// Adaptor to chain together two readers.
14191430
///
1420-
/// This struct is generally created by calling [`chain()`][chain] on a reader.
1421-
/// Please see the documentation of `chain()` for more details.
1431+
/// This struct is generally created by calling [`chain()`] on a reader.
1432+
/// Please see the documentation of [`chain()`] for more details.
14221433
///
1423-
/// [chain]: trait.Read.html#method.chain
1434+
/// [`chain()`]: trait.Read.html#method.chain
14241435
#[stable(feature = "rust1", since = "1.0.0")]
14251436
pub struct Chain<T, U> {
14261437
first: T,
@@ -1581,10 +1592,10 @@ fn read_one_byte(reader: &mut Read) -> Option<Result<u8>> {
15811592

15821593
/// An iterator over `u8` values of a reader.
15831594
///
1584-
/// This struct is generally created by calling [`bytes()`][bytes] on a reader.
1585-
/// Please see the documentation of `bytes()` for more details.
1595+
/// This struct is generally created by calling [`bytes()`] on a reader.
1596+
/// Please see the documentation of [`bytes()`] for more details.
15861597
///
1587-
/// [bytes]: trait.Read.html#method.bytes
1598+
/// [`bytes()`]: trait.Read.html#method.bytes
15881599
#[stable(feature = "rust1", since = "1.0.0")]
15891600
pub struct Bytes<R> {
15901601
inner: R,

0 commit comments

Comments
 (0)