Stabilize Seek::rewind

This commit is contained in:
Aris Merchant 2021-07-01 15:07:09 -07:00
parent a435b49e86
commit 6d34a2e007
2 changed files with 5 additions and 2 deletions

View file

@ -1736,7 +1736,6 @@ pub trait Seek {
/// # Example /// # Example
/// ///
/// ```no_run /// ```no_run
/// #![feature(seek_rewind)]
/// use std::io::{Read, Seek, Write}; /// use std::io::{Read, Seek, Write};
/// use std::fs::OpenOptions; /// use std::fs::OpenOptions;
/// ///
@ -1754,7 +1753,7 @@ pub trait Seek {
/// f.read_to_string(&mut buf).unwrap(); /// f.read_to_string(&mut buf).unwrap();
/// assert_eq!(&buf, hello); /// assert_eq!(&buf, hello);
/// ``` /// ```
#[unstable(feature = "seek_rewind", issue = "85149")] #[stable(feature = "seek_rewind", since = "1.55.0")]
fn rewind(&mut self) -> Result<()> { fn rewind(&mut self) -> Result<()> {
self.seek(SeekFrom::Start(0))?; self.seek(SeekFrom::Start(0))?;
Ok(()) Ok(())

View file

@ -336,6 +336,10 @@ fn seek_position() -> io::Result<()> {
assert_eq!(c.stream_position()?, 8); assert_eq!(c.stream_position()?, 8);
assert_eq!(c.stream_position()?, 8); assert_eq!(c.stream_position()?, 8);
c.rewind()?;
assert_eq!(c.stream_position()?, 0);
assert_eq!(c.stream_position()?, 0);
Ok(()) Ok(())
} }