Revise the documentation for try_clone.

On Unix, describe these in terms of the underlying "file description". On
Windows, describe them in terms of the underlying "object".
This commit is contained in:
Dan Gohman 2022-05-19 06:59:12 -07:00
parent 5d0eae81ae
commit 007cbfd1db
3 changed files with 8 additions and 6 deletions

View File

@ -77,8 +77,8 @@ impl BorrowedFd<'_> {
}
impl OwnedFd {
/// Creates a new `OwnedFd` instance that shares the same underlying file handle
/// as the existing `OwnedFd` instance.
/// Creates a new `OwnedFd` instance that shares the same underlying file
/// description as the existing `OwnedFd` instance.
#[stable(feature = "io_safety", since = "1.63.0")]
pub fn try_clone(&self) -> crate::io::Result<Self> {
self.as_fd().try_clone_to_owned()
@ -108,6 +108,8 @@ impl BorrowedFd<'_> {
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
}
/// Creates a new `OwnedFd` instance that shares the same underlying file
/// description as the existing `BorrowedFd` instance.
#[cfg(target_arch = "wasm32")]
#[stable(feature = "io_safety", since = "1.63.0")]
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {

View File

@ -177,8 +177,8 @@ impl TryFrom<HandleOrNull> for OwnedHandle {
}
impl OwnedHandle {
/// Creates a new `OwnedHandle` instance that shares the same underlying file handle
/// as the existing `OwnedHandle` instance.
/// Creates a new `OwnedHandle` instance that shares the same underlying
/// object as the existing `OwnedHandle` instance.
#[stable(feature = "io_safety", since = "1.63.0")]
pub fn try_clone(&self) -> crate::io::Result<Self> {
self.as_handle().try_clone_to_owned()

View File

@ -82,8 +82,8 @@ impl BorrowedSocket<'_> {
}
impl OwnedSocket {
/// Creates a new `OwnedSocket` instance that shares the same underlying socket
/// as the existing `OwnedSocket` instance.
/// Creates a new `OwnedSocket` instance that shares the same underlying
/// object as the existing `OwnedSocket` instance.
#[stable(feature = "io_safety", since = "1.63.0")]
pub fn try_clone(&self) -> io::Result<Self> {
self.as_socket().try_clone_to_owned()