mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #86794 - inquisitivecrystal:seek-rewind, r=m-ou-se
Stabilize `Seek::rewind()` This stabilizes `Seek::rewind`. It seemed to fit into one of the existing tests, so I extended that test rather than adding a new one. Closes #85149.
This commit is contained in:
commit
2bc7d4d70a
@ -1759,7 +1759,6 @@ pub trait Seek {
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// #![feature(seek_rewind)]
|
||||
/// use std::io::{Read, Seek, Write};
|
||||
/// use std::fs::OpenOptions;
|
||||
///
|
||||
@ -1777,7 +1776,7 @@ pub trait Seek {
|
||||
/// f.read_to_string(&mut buf).unwrap();
|
||||
/// assert_eq!(&buf, hello);
|
||||
/// ```
|
||||
#[unstable(feature = "seek_rewind", issue = "85149")]
|
||||
#[stable(feature = "seek_rewind", since = "1.55.0")]
|
||||
fn rewind(&mut self) -> Result<()> {
|
||||
self.seek(SeekFrom::Start(0))?;
|
||||
Ok(())
|
||||
|
@ -336,6 +336,10 @@ fn seek_position() -> io::Result<()> {
|
||||
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(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user