Stabilize std::os::*::fs::FileExt
This commit is contained in:
parent
95373cd5d8
commit
df26a5a958
@ -21,7 +21,7 @@ use sys_common::{FromInner, AsInner, AsInnerMut};
|
||||
use sys::platform::fs::MetadataExt as UnixMetadataExt;
|
||||
|
||||
/// Unix-specific extensions to `File`
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
pub trait FileExt {
|
||||
/// Reads a number of bytes starting from a given offset.
|
||||
///
|
||||
@ -34,7 +34,7 @@ pub trait FileExt {
|
||||
///
|
||||
/// Note that similar to `File::read`, it is not an error to return with a
|
||||
/// short read.
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize>;
|
||||
|
||||
/// Writes a number of bytes starting from a given offset.
|
||||
@ -51,11 +51,11 @@ pub trait FileExt {
|
||||
///
|
||||
/// Note that similar to `File::write`, it is not an error to return a
|
||||
/// short write.
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize>;
|
||||
}
|
||||
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
impl FileExt for fs::File {
|
||||
fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
|
||||
self.as_inner().read_at(buf, offset)
|
||||
|
@ -50,7 +50,7 @@ pub mod prelude {
|
||||
pub use super::fs::{PermissionsExt, OpenOptionsExt, MetadataExt, FileTypeExt};
|
||||
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use super::fs::DirEntryExt;
|
||||
#[doc(no_inline)] #[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[doc(no_inline)] #[stable(feature = "file_offset", since = "1.15.0")]
|
||||
pub use super::fs::FileExt;
|
||||
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use super::thread::JoinHandleExt;
|
||||
|
@ -19,7 +19,7 @@ use sys;
|
||||
use sys_common::{AsInnerMut, AsInner};
|
||||
|
||||
/// Windows-specific extensions to `File`
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
pub trait FileExt {
|
||||
/// Seeks to a given position and reads a number of bytes.
|
||||
///
|
||||
@ -35,7 +35,7 @@ pub trait FileExt {
|
||||
/// Note that similar to `File::read`, it is not an error to return with a
|
||||
/// short read. When returning from such a short read, the file pointer is
|
||||
/// still updated.
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
fn seek_read(&self, buf: &mut [u8], offset: u64) -> io::Result<usize>;
|
||||
|
||||
/// Seeks to a given position and writes a number of bytes.
|
||||
@ -52,11 +52,11 @@ pub trait FileExt {
|
||||
/// Note that similar to `File::write`, it is not an error to return a
|
||||
/// short write. When returning from such a short write, the file pointer
|
||||
/// is still updated.
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
fn seek_write(&self, buf: &[u8], offset: u64) -> io::Result<usize>;
|
||||
}
|
||||
|
||||
#[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[stable(feature = "file_offset", since = "1.15.0")]
|
||||
impl FileExt for fs::File {
|
||||
fn seek_read(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
|
||||
self.as_inner().read_at(buf, offset)
|
||||
|
@ -36,6 +36,6 @@ pub mod prelude {
|
||||
pub use super::ffi::{OsStrExt, OsStringExt};
|
||||
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use super::fs::{OpenOptionsExt, MetadataExt};
|
||||
#[doc(no_inline)] #[unstable(feature = "file_offset", issue = "35918")]
|
||||
#[doc(no_inline)] #[stable(feature = "file_offset", since = "1.15.0")]
|
||||
pub use super::fs::FileExt;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user