File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -917,6 +917,13 @@ pub trait Read {
917
917
/// # }
918
918
/// ```
919
919
///
920
+ /// # Notes
921
+ ///
922
+ /// Be careful using this trait method with streams that are expected to be continuous. For example, using
923
+ /// `read_to_end` with streams like `stdin` will simply lock the application into waiting on the
924
+ /// transmission of data to conclude. It is recommended you use this method if you know the stream will be closed
925
+ /// at the other end. The problem is that EOF or End of File is never reached for streams that never close or are finite.
926
+ ///
920
927
/// [`Vec::try_reserve`]: crate::vec::Vec::try_reserve
921
928
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
922
929
fn read_to_end ( & mut self , buf : & mut Vec < u8 > ) -> Result < usize > {
@@ -957,6 +964,13 @@ pub trait Read {
957
964
/// }
958
965
/// ```
959
966
///
967
+ /// # Notes
968
+ ///
969
+ /// Be careful using this trait method with streams that are expected to be continuous. For example, using
970
+ /// `read_to_string` with streams like `stdin` will simply lock the application into waiting on the
971
+ /// transmission of data to conclude. It is recommended you use this method if you know the stream will be closed
972
+ /// at the other end. The problem is that EOF or End of File is never reached for streams that never close or are finite.
973
+ ///
960
974
/// (See also the [`std::fs::read_to_string`] convenience function for
961
975
/// reading from a file.)
962
976
///
You can’t perform that action at this time.
0 commit comments