Skip to content

Commit

Permalink
Auto merge of #37259 - GuillaumeGomez:fix_io_urls, r=frewsxcv
Browse files Browse the repository at this point in the history
Add more io urls

r? @steveklabnik
  • Loading branch information
bors committed Oct 19, 2016
2 parents 0c42987 + b12f63b commit a41505f
Showing 1 changed file with 52 additions and 41 deletions.
93 changes: 52 additions & 41 deletions src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
///
/// For example, reading line-by-line is inefficient without using a buffer, so
/// if you want to read by line, you'll need `BufRead`, which includes a
/// [`read_line()`][readline] method as well as a [`lines()`][lines] iterator.
///
/// [readline]: #method.read_line
/// [lines]: #method.lines
/// [`read_line()`] method as well as a [`lines()`] iterator.
///
/// # Examples
///
Expand All @@ -1173,14 +1170,17 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// }
/// ```
///
/// If you have something that implements `Read`, you can use the [`BufReader`
/// type][bufreader] to turn it into a `BufRead`.
/// If you have something that implements [`Read`], you can use the [`BufReader`
/// type][`BufReader`] to turn it into a `BufRead`.
///
/// For example, [`File`][file] implements `Read`, but not `BufRead`.
/// `BufReader` to the rescue!
/// For example, [`File`] implements [`Read`], but not `BufRead`.
/// [`BufReader`] to the rescue!
///
/// [bufreader]: struct.BufReader.html
/// [file]: ../fs/struct.File.html
/// [`BufReader`]: struct.BufReader.html
/// [`File`]: ../fs/struct.File.html
/// [`read_line()`]: #method.read_line
/// [`lines()`]: #method.lines
/// [`Read`]: trait.Read.html
///
/// ```
/// use std::io::{self, BufReader};
Expand All @@ -1204,13 +1204,13 @@ pub trait BufRead: Read {
/// Fills the internal buffer of this object, returning the buffer contents.
///
/// This function is a lower-level call. It needs to be paired with the
/// [`consume`][consume] method to function properly. When calling this
/// [`consume()`] method to function properly. When calling this
/// method, none of the contents will be "read" in the sense that later
/// calling `read` may return the same contents. As such, `consume` must be
/// called with the number of bytes that are consumed from this buffer to
/// calling `read` may return the same contents. As such, [`consume()`] must
/// be called with the number of bytes that are consumed from this buffer to
/// ensure that the bytes are never returned twice.
///
/// [consume]: #tymethod.consume
/// [`consume()`]: #tymethod.consume
///
/// An empty buffer returned indicates that the stream has reached EOF.
///
Expand Down Expand Up @@ -1251,21 +1251,21 @@ pub trait BufRead: Read {
/// so they should no longer be returned in calls to `read`.
///
/// This function is a lower-level call. It needs to be paired with the
/// [`fill_buf`][fillbuf] method to function properly. This function does
/// [`fill_buf()`] method to function properly. This function does
/// not perform any I/O, it simply informs this object that some amount of
/// its buffer, returned from `fill_buf`, has been consumed and should no
/// longer be returned. As such, this function may do odd things if
/// `fill_buf` isn't called before calling it.
///
/// [fillbuf]: #tymethod.fill_buf
/// its buffer, returned from [`fill_buf()`], has been consumed and should
/// no longer be returned. As such, this function may do odd things if
/// [`fill_buf()`] isn't called before calling it.
///
/// The `amt` must be `<=` the number of bytes in the buffer returned by
/// `fill_buf`.
/// [`fill_buf()`].
///
/// # Examples
///
/// Since `consume()` is meant to be used with [`fill_buf()`][fillbuf],
/// Since `consume()` is meant to be used with [`fill_buf()`],
/// that method's example includes an example of `consume()`.
///
/// [`fill_buf()`]: #tymethod.fill_buf
#[stable(feature = "rust1", since = "1.0.0")]
fn consume(&mut self, amt: usize);

Expand All @@ -1279,8 +1279,8 @@ pub trait BufRead: Read {
///
/// # Errors
///
/// This function will ignore all instances of `ErrorKind::Interrupted` and
/// will otherwise return any errors returned by `fill_buf`.
/// This function will ignore all instances of [`ErrorKind::Interrupted`] and
/// will otherwise return any errors returned by [`fill_buf()`].
///
/// If an I/O error is encountered then all bytes read so far will be
/// present in `buf` and its length will have been adjusted appropriately.
Expand All @@ -1290,6 +1290,9 @@ pub trait BufRead: Read {
/// A locked standard input implements `BufRead`. In this example, we'll
/// read from standard input until we see an `a` byte.
///
/// [`fill_buf()`]: #tymethod.fill_buf
/// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted
///
/// ```
/// use std::io;
/// use std::io::prelude::*;
Expand Down Expand Up @@ -1322,19 +1325,20 @@ pub trait BufRead: Read {
///
/// # Errors
///
/// This function has the same error semantics as `read_until` and will also
/// return an error if the read bytes are not valid UTF-8. If an I/O error
/// is encountered then `buf` may contain some bytes already read in the
/// event that all data read so far was valid UTF-8.
/// This function has the same error semantics as [`read_until()`] and will
/// also return an error if the read bytes are not valid UTF-8. If an I/O
/// error is encountered then `buf` may contain some bytes already read in
/// the event that all data read so far was valid UTF-8.
///
/// # Examples
///
/// A locked standard input implements `BufRead`. In this example, we'll
/// read all of the lines from standard input. If we were to do this in
/// an actual project, the [`lines()`][lines] method would be easier, of
/// an actual project, the [`lines()`] method would be easier, of
/// course.
///
/// [lines]: #method.lines
/// [`lines()`]: #method.lines
/// [`read_until()`]: #method.read_until
///
/// ```
/// use std::io;
Expand Down Expand Up @@ -1363,17 +1367,21 @@ pub trait BufRead: Read {
/// `byte`.
///
/// The iterator returned from this function will return instances of
/// `io::Result<Vec<u8>>`. Each vector returned will *not* have the
/// delimiter byte at the end.
/// [`io::Result`]`<`[`Vec<u8>`]`>`. Each vector returned will *not* have
/// the delimiter byte at the end.
///
/// This function will yield errors whenever `read_until` would have also
/// yielded an error.
/// This function will yield errors whenever [`read_until()`] would have
/// also yielded an error.
///
/// # Examples
///
/// A locked standard input implements `BufRead`. In this example, we'll
/// read some input from standard input, splitting on commas.
///
/// [`io::Result`]: type.Result.html
/// [`Vec<u8>`]: ../vec/struct.Vec.html
/// [`read_until()`]: #method.read_until
///
/// ```
/// use std::io;
/// use std::io::prelude::*;
Expand All @@ -1392,9 +1400,12 @@ pub trait BufRead: Read {
/// Returns an iterator over the lines of this reader.
///
/// The iterator returned from this function will yield instances of
/// `io::Result<String>`. Each string returned will *not* have a newline
/// [`io::Result`]`<`[`String`]`>`. Each string returned will *not* have a newline
/// byte (the 0xA byte) or CRLF (0xD, 0xA bytes) at the end.
///
/// [`io::Result`]: type.Result.html
/// [`String`]: ../string/struct.String.html
///
/// # Examples
///
/// A locked standard input implements `BufRead`:
Expand All @@ -1417,10 +1428,10 @@ pub trait BufRead: Read {

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

/// An iterator over `u8` values of a reader.
///
/// This struct is generally created by calling [`bytes()`][bytes] on a reader.
/// Please see the documentation of `bytes()` for more details.
/// This struct is generally created by calling [`bytes()`] on a reader.
/// Please see the documentation of [`bytes()`] for more details.
///
/// [bytes]: trait.Read.html#method.bytes
/// [`bytes()`]: trait.Read.html#method.bytes
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Bytes<R> {
inner: R,
Expand Down

0 comments on commit a41505f

Please sign in to comment.