diff options
| author | Jonathan Behrens <fintelia@gmail.com> | 2023-10-14 16:20:32 -0700 |
|---|---|---|
| committer | Jonathan Behrens <fintelia@gmail.com> | 2023-10-14 16:20:32 -0700 |
| commit | d6337e65683ea982006ebfb4cf4881b1d3fe5aad (patch) | |
| tree | 4168b850effde8a731e46101610312bcf4b7a4ec /library/std/src/io/buffered/bufreader.rs | |
| parent | ee8c9d3c34719a129f280cd91ba5d324017bb02b (diff) | |
| download | rust-d6337e65683ea982006ebfb4cf4881b1d3fe5aad.tar.gz rust-d6337e65683ea982006ebfb4cf4881b1d3fe5aad.zip | |
Add Seek::seek_relative
Diffstat (limited to 'library/std/src/io/buffered/bufreader.rs')
| -rw-r--r-- | library/std/src/io/buffered/bufreader.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/library/std/src/io/buffered/bufreader.rs b/library/std/src/io/buffered/bufreader.rs index 7097dfef88d..db4f479d459 100644 --- a/library/std/src/io/buffered/bufreader.rs +++ b/library/std/src/io/buffered/bufreader.rs @@ -492,6 +492,16 @@ impl<R: ?Sized + Seek> Seek for BufReader<R> { ) }) } + + /// Seeks relative to the current position. + /// + /// If the new position lies within the buffer, the buffer will not be + /// flushed, allowing for more efficient seeks. This method does not return + /// the location of the underlying reader, so the caller must track this + /// information themselves if it is required. + fn seek_relative(&mut self, offset: i64) -> io::Result<()> { + self.seek_relative(offset) + } } impl<T: ?Sized> SizeHint for BufReader<T> { |
