File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1482,6 +1482,24 @@ impl<T> Take<T> {
1482
1482
///
1483
1483
/// This instance may reach EOF after reading fewer bytes than indicated by
1484
1484
/// this method if the underlying `Read` instance reaches EOF.
1485
+ ///
1486
+ /// # Examples
1487
+ ///
1488
+ /// ```
1489
+ /// use std::io;
1490
+ /// use std::io::prelude::*;
1491
+ /// use std::fs::File;
1492
+ ///
1493
+ /// # fn foo() -> io::Result<()> {
1494
+ /// let f = try!(File::open("foo.txt"));
1495
+ ///
1496
+ /// // read at most five bytes
1497
+ /// let handle = f.take(5);
1498
+ ///
1499
+ /// println!("limit: {}", handle.limit());
1500
+ /// # Ok(())
1501
+ /// # }
1502
+ /// ```
1485
1503
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1486
1504
pub fn limit ( & self ) -> u64 { self . limit }
1487
1505
}
You can’t perform that action at this time.
0 commit comments