mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
io: add get_mut, get_ref and into_inner to Lines (#2450)
This commit is contained in:
parent
45773c5641
commit
7a89d66513
@ -59,6 +59,24 @@ where
|
||||
|
||||
poll_fn(|cx| Pin::new(&mut *self).poll_next_line(cx)).await
|
||||
}
|
||||
|
||||
/// Obtain a mutable reference to the underlying reader
|
||||
pub fn get_mut(&mut self) -> &mut R {
|
||||
&mut self.reader
|
||||
}
|
||||
|
||||
/// Obtain a reference to the underlying reader
|
||||
pub fn get_ref(&mut self) -> &R {
|
||||
&self.reader
|
||||
}
|
||||
|
||||
/// Unwraps this `Lines<R>`, returning the underlying reader.
|
||||
///
|
||||
/// Note that any leftover data in the internal buffer is lost.
|
||||
/// Therefore, a following read from the underlying reader may lead to data loss.
|
||||
pub fn into_inner(self) -> R {
|
||||
self.reader
|
||||
}
|
||||
}
|
||||
|
||||
impl<R> Lines<R>
|
||||
|
Loading…
x
Reference in New Issue
Block a user