diff --git a/tokio/src/io/util/lines.rs b/tokio/src/io/util/lines.rs index f0e75de4b..be4e86648 100644 --- a/tokio/src/io/util/lines.rs +++ b/tokio/src/io/util/lines.rs @@ -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`, 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 Lines