238
238
//! contract. The implementation of many of these functions are subject to change over
239
239
//! time and may call fewer or more syscalls/library functions.
240
240
//!
241
- //! [`Read`]: trait.Read.html
242
- //! [`Write`]: trait.Write.html
243
- //! [`Seek`]: trait.Seek.html
244
- //! [`BufRead`]: trait.BufRead.html
245
- //! [`File`]: ../fs/struct.File.html
246
- //! [`TcpStream`]: ../net/struct.TcpStream.html
247
- //! [`Vec<T>`]: ../vec/struct.Vec.html
248
- //! [`BufReader`]: struct.BufReader.html
249
- //! [`BufWriter`]: struct.BufWriter.html
250
- //! [`Write::write`]: trait.Write.html#tymethod.write
251
- //! [`io::stdout`]: fn.stdout.html
252
- //! [`println!`]: ../macro.println.html
253
- //! [`Lines`]: struct.Lines.html
254
- //! [`io::Result`]: type.Result.html
241
+ //! [`File`]: crate::fs::File
242
+ //! [`TcpStream`]: crate::net::TcpStream
243
+ //! [`Vec<T>`]: crate::vec::Vec
244
+ //! [`io::stdout`]: stdout
245
+ //! [`io::Result`]: crate::io::Result
255
246
//! [`?` operator]: ../../book/appendix-02-operators.html
256
- //! [`Read::read`]: trait.Read.html#tymethod.read
257
- //! [`Result`]: ../result/enum.Result.html
258
- //! [`.unwrap()`]: ../result/enum.Result.html#method.unwrap
259
- // ignore-tidy-filelength
247
+ //! [`Result`]: crate::result::Result
248
+ //! [`.unwrap()`]: crate::result::Result::unwrap
260
249
261
250
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
262
251
@@ -491,12 +480,10 @@ where
491
480
/// }
492
481
/// ```
493
482
///
494
- /// [`read()`]: trait.Read.html#tymethod.read
495
- /// [`std::io`]: ../../std/io/index.html
496
- /// [`File`]: ../fs/struct.File.html
497
- /// [`BufRead`]: trait.BufRead.html
498
- /// [`BufReader`]: struct.BufReader.html
499
- /// [`&str`]: ../../std/primitive.str.html
483
+ /// [`read()`]: Read::read
484
+ /// [`&str`]: str
485
+ /// [`std::io`]: self
486
+ /// [`File`]: crate::fs::File
500
487
/// [slice]: ../../std/primitive.slice.html
501
488
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
502
489
#[ doc( spotlight) ]
@@ -535,7 +522,7 @@ pub trait Read {
535
522
/// before calling `read`. Calling `read` with an uninitialized `buf` (of the kind one
536
523
/// obtains via [`MaybeUninit<T>`]) is not safe, and can lead to undefined behavior.
537
524
///
538
- /// [`MaybeUninit<T>`]: ../ mem/union. MaybeUninit.html
525
+ /// [`MaybeUninit<T>`]: crate:: mem:: MaybeUninit
539
526
///
540
527
/// # Errors
541
528
///
@@ -550,10 +537,8 @@ pub trait Read {
550
537
///
551
538
/// [`File`]s implement `Read`:
552
539
///
553
- /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
554
- /// [`Ok(n)`]: ../../std/result/enum.Result.html#variant.Ok
555
- /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
556
- /// [`File`]: ../fs/struct.File.html
540
+ /// [`Ok(n)`]: Ok
541
+ /// [`File`]: crate::fs::File
557
542
///
558
543
/// ```no_run
559
544
/// use std::io;
@@ -620,9 +605,6 @@ pub trait Read {
620
605
/// This method is unsafe because a `Read`er could otherwise return a
621
606
/// non-zeroing `Initializer` from another `Read` type without an `unsafe`
622
607
/// block.
623
- ///
624
- /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
625
- /// [`Initializer`]: ../../std/io/struct.Initializer.html
626
608
#[ unstable( feature = "read_initializer" , issue = "42788" ) ]
627
609
#[ inline]
628
610
unsafe fn initializer ( & self ) -> Initializer {
@@ -652,10 +634,9 @@ pub trait Read {
652
634
///
653
635
/// [`File`]s implement `Read`:
654
636
///
655
- /// [`read()`]: trait.Read.html#tymethod.read
656
- /// [`Ok(0)`]: ../../std/result/enum.Result.html#variant.Ok
657
- /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
658
- /// [`File`]: ../fs/struct.File.html
637
+ /// [`read()`]: Read::read
638
+ /// [`Ok(0)`]: Ok
639
+ /// [`File`]: crate::fs::File
659
640
///
660
641
/// ```no_run
661
642
/// use std::io;
@@ -675,7 +656,7 @@ pub trait Read {
675
656
/// (See also the [`std::fs::read`] convenience function for reading from a
676
657
/// file.)
677
658
///
678
- /// [`std::fs::read`]: ../fs/fn. read.html
659
+ /// [`std::fs::read`]: crate::fs:: read
679
660
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
680
661
fn read_to_end ( & mut self , buf : & mut Vec < u8 > ) -> Result < usize > {
681
662
read_to_end ( self , buf)
@@ -693,13 +674,13 @@ pub trait Read {
693
674
///
694
675
/// See [`read_to_end`][readtoend] for other error semantics.
695
676
///
696
- /// [readtoend]: #method. read_to_end
677
+ /// [readtoend]: Self:: read_to_end
697
678
///
698
679
/// # Examples
699
680
///
700
681
/// [`File`][file]s implement `Read`:
701
682
///
702
- /// [file]: ../fs/struct. File.html
683
+ /// [file]: crate::fs:: File
703
684
///
704
685
/// ```no_run
705
686
/// use std::io;
@@ -718,7 +699,7 @@ pub trait Read {
718
699
/// (See also the [`std::fs::read_to_string`] convenience function for
719
700
/// reading from a file.)
720
701
///
721
- /// [`std::fs::read_to_string`]: ../fs/fn. read_to_string.html
702
+ /// [`std::fs::read_to_string`]: crate::fs:: read_to_string
722
703
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
723
704
fn read_to_string ( & mut self , buf : & mut String ) -> Result < usize > {
724
705
// Note that we do *not* call `.read_to_end()` here. We are passing
@@ -764,9 +745,7 @@ pub trait Read {
764
745
///
765
746
/// [`File`]s implement `Read`:
766
747
///
767
- /// [`File`]: ../fs/struct.File.html
768
- /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
769
- /// [`ErrorKind::UnexpectedEof`]: ../../std/io/enum.ErrorKind.html#variant.UnexpectedEof
748
+ /// [`File`]: crate::fs::File
770
749
///
771
750
/// ```no_run
772
751
/// use std::io;
@@ -811,7 +790,7 @@ pub trait Read {
811
790
///
812
791
/// [`File`][file]s implement `Read`:
813
792
///
814
- /// [file]: ../fs/struct. File.html
793
+ /// [file]: crate::fs:: File
815
794
///
816
795
/// ```no_run
817
796
/// use std::io;
@@ -855,14 +834,10 @@ pub trait Read {
855
834
///
856
835
/// [`File`][file]s implement `Read`:
857
836
///
858
- /// [file]: ../fs/struct.File.html
859
- /// [`Iterator`]: ../../std/iter/trait.Iterator.html
860
- /// [`Result`]: ../../std/result/enum.Result.html
861
- /// [`io::Error`]: ../../std/io/struct.Error.html
862
- /// [`u8`]: ../../std/primitive.u8.html
863
- /// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
864
- /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
865
- /// [`None`]: ../../std/option/enum.Option.html#variant.None
837
+ /// [file]: crate::fs::File
838
+ /// [`Iterator`]: crate::iter::Iterator
839
+ /// [`Result`]: crate::result::Result
840
+ /// [`io::Error`]: self::Error
866
841
///
867
842
/// ```no_run
868
843
/// use std::io;
@@ -896,7 +871,7 @@ pub trait Read {
896
871
///
897
872
/// [`File`][file]s implement `Read`:
898
873
///
899
- /// [file]: ../fs/struct. File.html
874
+ /// [file]: crate::fs:: File
900
875
///
901
876
/// ```no_run
902
877
/// use std::io;
@@ -935,9 +910,9 @@ pub trait Read {
935
910
///
936
911
/// [`File`]s implement `Read`:
937
912
///
938
- /// [`File`]: ../fs/struct. File.html
939
- /// [`Ok(0)`]: ../../std/result/enum.Result.html#variant. Ok
940
- /// [`read()`]: trait. Read.html#tymethod. read
913
+ /// [`File`]: crate::fs:: File
914
+ /// [`Ok(0)`]: Ok
915
+ /// [`read()`]: Read:: read
941
916
///
942
917
/// ```no_run
943
918
/// use std::io;
@@ -1233,8 +1208,8 @@ impl Initializer {
1233
1208
/// throughout [`std::io`] take and provide types which implement the `Write`
1234
1209
/// trait.
1235
1210
///
1236
- /// [`write`]: #tymethod. write
1237
- /// [`flush`]: #tymethod. flush
1211
+ /// [`write`]: Self:: write
1212
+ /// [`flush`]: Self:: flush
1238
1213
/// [`std::io`]: index.html
1239
1214
///
1240
1215
/// # Examples
@@ -1260,7 +1235,7 @@ impl Initializer {
1260
1235
/// The trait also provides convenience methods like [`write_all`], which calls
1261
1236
/// `write` in a loop until its entire input has been written.
1262
1237
///
1263
- /// [`write_all`]: #method. write_all
1238
+ /// [`write_all`]: Self:: write_all
1264
1239
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1265
1240
#[ doc( spotlight) ]
1266
1241
pub trait Write {
@@ -1292,10 +1267,6 @@ pub trait Write {
1292
1267
/// An error of the [`ErrorKind::Interrupted`] kind is non-fatal and the
1293
1268
/// write operation should be retried if there is nothing else to do.
1294
1269
///
1295
- /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
1296
- /// [`Ok(n)`]: ../../std/result/enum.Result.html#variant.Ok
1297
- /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
1298
- ///
1299
1270
/// # Examples
1300
1271
///
1301
1272
/// ```no_run
@@ -1381,8 +1352,7 @@ pub trait Write {
1381
1352
/// This function will return the first error of
1382
1353
/// non-[`ErrorKind::Interrupted`] kind that [`write`] returns.
1383
1354
///
1384
- /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
1385
- /// [`write`]: #tymethod.write
1355
+ /// [`write`]: Self::write
1386
1356
///
1387
1357
/// # Examples
1388
1358
///
@@ -1423,8 +1393,7 @@ pub trait Write {
1423
1393
///
1424
1394
/// If the buffer contains no data, this will never call [`write_vectored`].
1425
1395
///
1426
- /// [`write_vectored`]: #method.write_vectored
1427
- /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
1396
+ /// [`write_vectored`]: Self::write_vectored
1428
1397
///
1429
1398
/// # Notes
1430
1399
///
@@ -1480,19 +1449,16 @@ pub trait Write {
1480
1449
/// encountered.
1481
1450
///
1482
1451
/// This method is primarily used to interface with the
1483
- /// [`format_args!`][formatargs ] macro, but it is rare that this should
1484
- /// explicitly be called. The [`write!`][write] macro should be favored to
1452
+ /// [`format_args!()` ] macro, but it is rare that this should
1453
+ /// explicitly be called. The [`write!() `][write] macro should be favored to
1485
1454
/// invoke this method instead.
1486
1455
///
1487
- /// [formatargs]: ../macro.format_args.html
1488
- /// [write]: ../macro.write.html
1489
- ///
1490
1456
/// This function internally uses the [`write_all`][writeall] method on
1491
1457
/// this trait and hence will continuously write data so long as no errors
1492
1458
/// are received. This also means that partial writes are not indicated in
1493
1459
/// this signature.
1494
1460
///
1495
- /// [writeall]: #method. write_all
1461
+ /// [writeall]: Self:: write_all
1496
1462
///
1497
1463
/// # Errors
1498
1464
///
@@ -1589,7 +1555,7 @@ pub trait Write {
1589
1555
///
1590
1556
/// [`File`][file]s implement `Seek`:
1591
1557
///
1592
- /// [file]: ../fs/struct. File.html
1558
+ /// [file]: crate::fs:: File
1593
1559
///
1594
1560
/// ```no_run
1595
1561
/// use std::io;
@@ -1789,9 +1755,9 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) -> R
1789
1755
/// [`BufReader`] to the rescue!
1790
1756
///
1791
1757
/// [`BufReader`]: struct.BufReader.html
1792
- /// [`File`]: ../fs/struct. File.html
1793
- /// [`read_line`]: #method. read_line
1794
- /// [`lines`]: #method. lines
1758
+ /// [`File`]: crate::fs:: File
1759
+ /// [`read_line`]: Self:: read_line
1760
+ /// [`lines`]: Self:: lines
1795
1761
/// [`Read`]: trait.Read.html
1796
1762
///
1797
1763
/// ```no_run
@@ -1823,7 +1789,7 @@ pub trait BufRead: Read {
1823
1789
/// be called with the number of bytes that are consumed from this buffer to
1824
1790
/// ensure that the bytes are never returned twice.
1825
1791
///
1826
- /// [`consume`]: #tymethod. consume
1792
+ /// [`consume`]: Self:: consume
1827
1793
///
1828
1794
/// An empty buffer returned indicates that the stream has reached EOF.
1829
1795
///
@@ -1873,7 +1839,7 @@ pub trait BufRead: Read {
1873
1839
/// Since `consume()` is meant to be used with [`fill_buf`],
1874
1840
/// that method's example includes an example of `consume()`.
1875
1841
///
1876
- /// [`fill_buf`]: #tymethod. fill_buf
1842
+ /// [`fill_buf`]: Self:: fill_buf
1877
1843
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1878
1844
fn consume ( & mut self , amt : usize ) ;
1879
1845
@@ -1897,7 +1863,7 @@ pub trait BufRead: Read {
1897
1863
/// If an I/O error is encountered then all bytes read so far will be
1898
1864
/// present in `buf` and its length will have been adjusted appropriately.
1899
1865
///
1900
- /// [`fill_buf`]: #tymethod. fill_buf
1866
+ /// [`fill_buf`]: Self:: fill_buf
1901
1867
/// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted
1902
1868
///
1903
1869
/// # Examples
@@ -1962,7 +1928,7 @@ pub trait BufRead: Read {
1962
1928
/// error is encountered then `buf` may contain some bytes already read in
1963
1929
/// the event that all data read so far was valid UTF-8.
1964
1930
///
1965
- /// [`read_until`]: #method. read_until
1931
+ /// [`read_until`]: Self:: read_until
1966
1932
///
1967
1933
/// # Examples
1968
1934
///
@@ -2015,9 +1981,9 @@ pub trait BufRead: Read {
2015
1981
/// This function will yield errors whenever [`read_until`] would have
2016
1982
/// also yielded an error.
2017
1983
///
2018
- /// [`io::Result`]: type. Result.html
2019
- /// [`Vec<u8>`]: ../ vec/struct. Vec.html
2020
- /// [`read_until`]: #method. read_until
1984
+ /// [`io::Result`]: self:: Result
1985
+ /// [`Vec<u8>`]: crate:: vec:: Vec
1986
+ /// [`read_until`]: Self:: read_until
2021
1987
///
2022
1988
/// # Examples
2023
1989
///
@@ -2052,17 +2018,14 @@ pub trait BufRead: Read {
2052
2018
/// [`io::Result`]`<`[`String`]`>`. Each string returned will *not* have a newline
2053
2019
/// byte (the 0xA byte) or CRLF (0xD, 0xA bytes) at the end.
2054
2020
///
2055
- /// [`io::Result`]: type.Result.html
2056
- /// [`String`]: ../string/struct.String.html
2021
+ /// [`io::Result`]: self::Result
2057
2022
///
2058
2023
/// # Examples
2059
2024
///
2060
2025
/// [`std::io::Cursor`][`Cursor`] is a type that implements `BufRead`. In
2061
2026
/// this example, we use [`Cursor`] to iterate over all the lines in a byte
2062
2027
/// slice.
2063
2028
///
2064
- /// [`Cursor`]: struct.Cursor.html
2065
- ///
2066
2029
/// ```
2067
2030
/// use std::io::{self, BufRead};
2068
2031
///
@@ -2253,8 +2216,6 @@ impl<T> Take<T> {
2253
2216
/// This instance may reach `EOF` after reading fewer bytes than indicated by
2254
2217
/// this method if the underlying [`Read`] instance reaches EOF.
2255
2218
///
2256
- /// [`Read`]: ../../std/io/trait.Read.html
2257
- ///
2258
2219
/// # Examples
2259
2220
///
2260
2221
/// ```no_run
0 commit comments