Skip to content
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

Add doc links to std::os extension traits #49829

Merged
merged 2 commits into from
Apr 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion src/libstd/os/android/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::android::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/bitrig/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::bitrig::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/dragonfly/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::dragonfly::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/emscripten/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::emscripten::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/freebsd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::freebsd::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/fuchsia/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
use fs::Metadata;
use sys_common::AsInner;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
#[stable(feature = "metadata_ext2", since = "1.8.0")]
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/haiku/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::haiku::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/ios/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::ios::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/linux/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::linux::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/macos/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::macos::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/netbsd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::netbsd::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/openbsd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::openbsd::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/os/solaris/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use sys_common::AsInner;
#[allow(deprecated)]
use os::solaris::raw;

/// OS-specific extension methods for `fs::Metadata`
/// OS-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
Expand Down
10 changes: 7 additions & 3 deletions src/libstd/sys/redox/ext/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Unix-specific extension to the primitives in the `std::ffi` module
//! Redox-specific extension to the primitives in the `std::ffi` module.

#![stable(feature = "rust1", since = "1.0.0")]

Expand All @@ -17,7 +17,9 @@ use mem;
use sys::os_str::Buf;
use sys_common::{FromInner, IntoInner, AsInner};

/// Unix-specific extensions to `OsString`.
/// Redox-specific extensions to [`OsString`].
///
/// [`OsString`]: ../../../../std/ffi/struct.OsString.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStringExt {
/// Creates an `OsString` from a byte vector.
Expand All @@ -39,7 +41,9 @@ impl OsStringExt for OsString {
}
}

/// Unix-specific extensions to `OsStr`.
/// Redox-specific extensions to [`OsStr`].
///
/// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStrExt {
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
36 changes: 25 additions & 11 deletions src/libstd/sys/redox/ext/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use path::Path;
use sys;
use sys_common::{FromInner, AsInner, AsInnerMut};

/// Redox-specific extensions to `Permissions`
/// Redox-specific extensions to [`fs::Permissions`].
///
/// [`fs::Permissions`]: ../../../../std/fs/struct.Permissions.html
#[stable(feature = "fs_ext", since = "1.1.0")]
pub trait PermissionsExt {
/// Returns the underlying raw `mode_t` bits that are the standard Redox
Expand Down Expand Up @@ -95,7 +97,9 @@ impl PermissionsExt for Permissions {
}
}

/// Redox-specific extensions to `OpenOptions`
/// Redox-specific extensions to [`fs::OpenOptions`].
///
/// [`fs::OpenOptions`]: ../../../../std/fs/struct.OpenOptions.html
#[stable(feature = "fs_ext", since = "1.1.0")]
pub trait OpenOptionsExt {
/// Sets the mode bits that a new file will be created with.
Expand Down Expand Up @@ -163,13 +167,9 @@ impl OpenOptionsExt for OpenOptions {
}
}

// Hm, why are there casts here to the returned type, shouldn't the types always
// be the same? Right you are! Turns out, however, on android at least the types
// in the raw `stat` structure are not the same as the types being returned. Who
// knew!
//
// As a result to make sure this compiles for all platforms we do the manual
// casts and rely on manual lowering to `stat` if the raw type is desired.
/// Redox-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
#[stable(feature = "metadata_ext", since = "1.1.0")]
Expand Down Expand Up @@ -204,6 +204,13 @@ pub trait MetadataExt {
fn blocks(&self) -> u64;
}

// Hm, why are there casts here to the returned type, shouldn't the types always
// be the same? Right you are! Turns out, however, on android at least the types
// in the raw `stat` structure are not the same as the types being returned. Who
// knew!
//
// As a result to make sure this compiles for all platforms we do the manual
// casts and rely on manual lowering to `stat` if the raw type is desired.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change feels different than the others? If it's accurate, that's fine, but i wasn't sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was on the trait definition instead of the implementation (I assume that MetadataExt at one time had default implementations for all its methods). Sorry, I struggle with keeping the scope of my PRs limited.

#[stable(feature = "metadata_ext", since = "1.1.0")]
impl MetadataExt for fs::Metadata {
fn dev(&self) -> u64 {
Expand Down Expand Up @@ -253,7 +260,12 @@ impl MetadataExt for fs::Metadata {
}
}

/// Add special Redox types (block/char device, fifo and socket)
/// Redox-specific extensions for [`FileType`].
///
/// Adds support for special Unix file types such as block/character devices,
/// pipes, and sockets.
///
/// [`FileType`]: ../../../../std/fs/struct.FileType.html
#[stable(feature = "file_type_ext", since = "1.5.0")]
pub trait FileTypeExt {
/// Returns whether this file type is a block device.
Expand Down Expand Up @@ -307,8 +319,10 @@ pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()>
sys::fs::symlink(src.as_ref(), dst.as_ref())
}

/// Redox-specific extensions to [`fs::DirBuilder`].
///
/// [`fs::DirBuilder`]: ../../../../std/fs/struct.DirBuilder.html
#[stable(feature = "dir_builder", since = "1.6.0")]
/// An extension trait for `fs::DirBuilder` for Redox-specific options.
pub trait DirBuilderExt {
/// Sets the mode to create new directories with. This option defaults to
/// 0o777.
Expand Down
10 changes: 7 additions & 3 deletions src/libstd/sys/redox/ext/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Unix-specific extensions to primitives in the `std::process` module.
//! Redox-specific extensions to primitives in the `std::process` module.

#![stable(feature = "rust1", since = "1.0.0")]

Expand All @@ -18,7 +18,9 @@ use process;
use sys;
use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner};

/// Unix-specific extensions to the `std::process::Command` builder
/// Redox-specific extensions to the [`process::Command`] builder,
///
/// [`process::Command`]: ../../../../std/process/struct.Command.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait CommandExt {
/// Sets the child process's user id. This translates to a
Expand Down Expand Up @@ -107,7 +109,9 @@ impl CommandExt for process::Command {
}
}

/// Unix-specific extensions to `std::process::ExitStatus`
/// Redox-specific extensions to [`process::ExitStatus`].
///
/// [`process::ExitStatus`]: ../../../../std/process/struct.ExitStatus.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait ExitStatusExt {
/// Creates a new `ExitStatus` from the raw underlying `i32` return value of
Expand Down
6 changes: 4 additions & 2 deletions src/libstd/sys/redox/ext/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Unix-specific extensions to primitives in the `std::thread` module.
//! Redox-specific extensions to primitives in the `std::thread` module.

#![stable(feature = "thread_extensions", since = "1.9.0")]

Expand All @@ -19,7 +19,9 @@ use thread::JoinHandle;
#[allow(deprecated)]
pub type RawPthread = usize;

/// Unix-specific extensions to `std::thread::JoinHandle`
/// Redox-specific extensions to [`thread::JoinHandle`].
///
/// [`thread::JoinHandle`]: ../../../../std/thread/struct.JoinHandle.html
#[stable(feature = "thread_extensions", since = "1.9.0")]
pub trait JoinHandleExt {
/// Extracts the raw pthread_t without taking ownership
Expand Down
8 changes: 6 additions & 2 deletions src/libstd/sys/unix/ext/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ use mem;
use sys::os_str::Buf;
use sys_common::{FromInner, IntoInner, AsInner};

/// Unix-specific extensions to `OsString`.
/// Unix-specific extensions to [`OsString`].
///
/// [`OsString`]: ../../../../std/ffi/struct.OsString.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStringExt {
/// Creates an [`OsString`] from a byte vector.
Expand Down Expand Up @@ -66,7 +68,9 @@ impl OsStringExt for OsString {
}
}

/// Unix-specific extensions to `OsStr`.
/// Unix-specific extensions to [`OsStr`].
///
/// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait OsStrExt {
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
29 changes: 17 additions & 12 deletions src/libstd/sys/unix/ext/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ impl FileExt for fs::File {
}
}

/// Unix-specific extensions to `Permissions`
/// Unix-specific extensions to [`fs::Permissions`].
///
/// [`fs::Permissions`]: ../../../../std/fs/struct.Permissions.html
#[stable(feature = "fs_ext", since = "1.1.0")]
pub trait PermissionsExt {
/// Returns the underlying raw `st_mode` bits that contain the standard
Expand Down Expand Up @@ -180,7 +182,9 @@ impl PermissionsExt for Permissions {
}
}

/// Unix-specific extensions to `OpenOptions`
/// Unix-specific extensions to [`fs::OpenOptions`].
///
/// [`fs::OpenOptions`]: ../../../../std/fs/struct.OpenOptions.html
#[stable(feature = "fs_ext", since = "1.1.0")]
pub trait OpenOptionsExt {
/// Sets the mode bits that a new file will be created with.
Expand Down Expand Up @@ -246,13 +250,9 @@ impl OpenOptionsExt for OpenOptions {
}
}

// Hm, why are there casts here to the returned type, shouldn't the types always
// be the same? Right you are! Turns out, however, on android at least the types
// in the raw `stat` structure are not the same as the types being returned. Who
// knew!
//
// As a result to make sure this compiles for all platforms we do the manual
// casts and rely on manual lowering to `stat` if the raw type is desired.
/// Unix-specific extensions to [`fs::Metadata`].
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Returns the ID of the device containing the file.
Expand Down Expand Up @@ -555,7 +555,12 @@ impl MetadataExt for fs::Metadata {
fn blocks(&self) -> u64 { self.st_blocks() }
}

/// Add support for special unix types (block/char device, fifo and socket).
/// Unix-specific extensions for [`FileType`].
///
/// Adds support for special Unix file types such as block/character devices,
/// pipes, and sockets.
///
/// [`FileType`]: ../../../../std/fs/struct.FileType.html
#[stable(feature = "file_type_ext", since = "1.5.0")]
pub trait FileTypeExt {
/// Returns whether this file type is a block device.
Expand Down Expand Up @@ -701,10 +706,10 @@ pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()>
sys::fs::symlink(src.as_ref(), dst.as_ref())
}

#[stable(feature = "dir_builder", since = "1.6.0")]
/// An extension trait for [`fs::DirBuilder`] for unix-specific options.
/// Unix-specific extensions to [`fs::DirBuilder`].
///
/// [`fs::DirBuilder`]: ../../../../std/fs/struct.DirBuilder.html
#[stable(feature = "dir_builder", since = "1.6.0")]
pub trait DirBuilderExt {
/// Sets the mode to create new directories with. This option defaults to
/// 0o777.
Expand Down
Loading