Skip to content

Add Seek::seek_relative #116750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve documentation
  • Loading branch information
fintelia committed Nov 4, 2023
commit d9f7c9db02c023adfeba554971abbf11bb244994
6 changes: 5 additions & 1 deletion library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,9 @@ pub trait Seek {

/// Seeks relative to the current position.
///
/// This is equivalent to `self.seek(SeekFrom::Current(offset))`.
/// This is equivalent to `self.seek(SeekFrom::Current(offset))` but
/// doesn't return the new position which can allow some implementations
/// such as [`BufReader`] to perform more efficient seeks.
///
/// # Example
///
Expand All @@ -1978,6 +1980,8 @@ pub trait Seek {
/// Ok(())
/// }
/// ```
///
/// [`BufReader`]: crate::io::BufReader
#[unstable(feature = "seek_seek_relative", issue = "117374")]
fn seek_relative(&mut self, offset: i64) -> Result<()> {
self.seek(SeekFrom::Current(offset))?;
Expand Down