未验证 提交 2bc7d4d7 编写于 作者: Y Yuki Okushi 提交者: GitHub

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.
......@@ -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(())
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册