@@ -466,6 +466,9 @@ pub trait Read {
466
466
/// variant will be returned. If an error is returned then it must be
467
467
/// guaranteed that no bytes were read.
468
468
///
469
+ /// An error of the `ErrorKind::Interrupted` kind is non-fatal and the read
470
+ /// operation should be retried if there is nothing else to do.
471
+ ///
469
472
/// # Examples
470
473
///
471
474
/// [`File`][file]s implement `Read`:
@@ -481,7 +484,7 @@ pub trait Read {
481
484
/// let mut f = File::open("foo.txt")?;
482
485
/// let mut buffer = [0; 10];
483
486
///
484
- /// // read 10 bytes
487
+ /// // read up to 10 bytes
485
488
/// f.read(&mut buffer[..])?;
486
489
/// # Ok(())
487
490
/// # }
@@ -885,6 +888,9 @@ pub trait Write {
885
888
/// It is **not** considered an error if the entire buffer could not be
886
889
/// written to this writer.
887
890
///
891
+ /// An error of the `ErrorKind::Interrupted` kind is non-fatal and the
892
+ /// write operation should be retried if there is nothing else to do.
893
+ ///
888
894
/// # Examples
889
895
///
890
896
/// ```
@@ -894,6 +900,7 @@ pub trait Write {
894
900
/// # fn foo() -> std::io::Result<()> {
895
901
/// let mut buffer = File::create("foo.txt")?;
896
902
///
903
+ /// // Writes some prefix of the byte string, not necessarily all of it.
897
904
/// buffer.write(b"some bytes")?;
898
905
/// # Ok(())
899
906
/// # }
@@ -929,14 +936,17 @@ pub trait Write {
929
936
930
937
/// Attempts to write an entire buffer into this write.
931
938
///
932
- /// This method will continuously call `write` while there is more data to
933
- /// write. This method will not return until the entire buffer has been
934
- /// successfully written or an error occurs. The first error generated from
935
- /// this method will be returned.
939
+ /// This method will continuously call `write` until there is no more data
940
+ /// to be written or an error of non-`ErrorKind::Interrupted` kind is
941
+ /// returned. This method will not return until the entire buffer has been
942
+ /// successfully written or such an error occurs. The first error that is
943
+ /// not of `ErrorKind::Interrupted` kind generated from this method will be
944
+ /// returned.
936
945
///
937
946
/// # Errors
938
947
///
939
- /// This function will return the first error that `write` returns.
948
+ /// This function will return the first error of
949
+ /// non-`ErrorKind::Interrupted` kind that `write` returns.
940
950
///
941
951
/// # Examples
942
952
///
0 commit comments