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> {
14821482 ///
14831483 /// This instance may reach EOF after reading fewer bytes than indicated by
14841484 /// 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+ /// ```
14851503 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
14861504 pub fn limit ( & self ) -> u64 { self . limit }
14871505}
You can’t perform that action at this time.
0 commit comments