File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1501,6 +1501,33 @@ impl<T> Take<T> {
1501
1501
/// ```
1502
1502
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1503
1503
pub fn limit ( & self ) -> u64 { self . limit }
1504
+
1505
+ /// Consumes the `Take`, returning the wrapped reader.
1506
+ ///
1507
+ /// # Examples
1508
+ ///
1509
+ /// ```
1510
+ /// #![feature(io_take_into_inner)]
1511
+ ///
1512
+ /// use std::io;
1513
+ /// use std::io::prelude::*;
1514
+ /// use std::fs::File;
1515
+ ///
1516
+ /// # fn foo() -> io::Result<()> {
1517
+ /// let mut file = try!(File::open("foo.txt"));
1518
+ ///
1519
+ /// let mut buffer = [0; 5];
1520
+ /// let mut handle = file.take(5);
1521
+ /// try!(handle.read(&mut buffer));
1522
+ ///
1523
+ /// let file = handle.into_inner();
1524
+ /// # Ok(())
1525
+ /// # }
1526
+ /// ```
1527
+ #[ unstable( feature = "io_take_into_inner" , issue = "0" ) ]
1528
+ pub fn into_inner ( self ) -> T {
1529
+ self . inner
1530
+ }
1504
1531
}
1505
1532
1506
1533
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments