Use From/Into rather than the traits they replaced.
This commit is contained in:
@@ -8,9 +8,9 @@ use crate::os::raw;
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use crate::os::unix::io::OwnedFd;
|
use crate::os::unix::io::OwnedFd;
|
||||||
#[cfg(all(doc, unix))]
|
#[cfg(all(doc, unix))]
|
||||||
use crate::os::unix::io::{AsFd, FromFd, IntoFd};
|
use crate::os::unix::io::AsFd;
|
||||||
#[cfg(all(doc, target_os = "wasi"))]
|
#[cfg(all(doc, target_os = "wasi"))]
|
||||||
use crate::os::unix::io::{AsFd, FromFd, IntoFd};
|
use crate::os::unix::io::AsFd;
|
||||||
#[cfg(target_os = "wasi")]
|
#[cfg(target_os = "wasi")]
|
||||||
use crate::os::wasi::io::OwnedFd;
|
use crate::os::wasi::io::OwnedFd;
|
||||||
use crate::sys_common::{AsInner, IntoInner};
|
use crate::sys_common::{AsInner, IntoInner};
|
||||||
@@ -69,8 +69,9 @@ pub trait FromRawFd {
|
|||||||
/// will take responsibility for closing it when the object goes out of
|
/// will take responsibility for closing it when the object goes out of
|
||||||
/// scope.
|
/// scope.
|
||||||
///
|
///
|
||||||
/// However, consuming ownership is not strictly required. See
|
/// However, consuming ownership is not strictly required. Use a
|
||||||
/// [`FromFd::from_fd`] for an API which strictly consumes ownership.
|
/// [`From<OwnedFd>::from`] implementation for an API which strictly
|
||||||
|
/// consumes ownership.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
@@ -109,8 +110,9 @@ pub trait IntoRawFd {
|
|||||||
/// file descriptor to the caller. When used in this way, callers are then the unique
|
/// file descriptor to the caller. When used in this way, callers are then the unique
|
||||||
/// owners of the file descriptor and must close it once it's no longer needed.
|
/// owners of the file descriptor and must close it once it's no longer needed.
|
||||||
///
|
///
|
||||||
/// However, transferring ownership is not strictly required. See
|
/// However, transferring ownership is not strictly required. Use a
|
||||||
/// [`IntoFd::into_fd`] for an API which strictly transfers ownership.
|
/// [`Into<OwnedFd>::into`] implementation for an API which strictly
|
||||||
|
/// transfers ownership.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use crate::fs;
|
|||||||
use crate::io;
|
use crate::io;
|
||||||
use crate::net;
|
use crate::net;
|
||||||
#[cfg(doc)]
|
#[cfg(doc)]
|
||||||
use crate::os::windows::io::{AsHandle, AsSocket, FromHandle, FromSocket, IntoHandle, IntoSocket};
|
use crate::os::windows::io::{AsHandle, AsSocket};
|
||||||
use crate::os::windows::io::{OwnedHandle, OwnedSocket};
|
use crate::os::windows::io::{OwnedHandle, OwnedSocket};
|
||||||
use crate::os::windows::raw;
|
use crate::os::windows::raw;
|
||||||
use crate::sys;
|
use crate::sys;
|
||||||
@@ -48,8 +48,9 @@ pub trait FromRawHandle {
|
|||||||
/// will take responsibility for closing it when the object goes out of
|
/// will take responsibility for closing it when the object goes out of
|
||||||
/// scope.
|
/// scope.
|
||||||
///
|
///
|
||||||
/// However, consuming ownership is not strictly required. See
|
/// However, consuming ownership is not strictly required. Use a
|
||||||
/// [`FromHandle::from_handle`] for an API which strictly consumes ownership.
|
/// `From<OwnedHandle>::from` implementation for an API which strictly
|
||||||
|
/// consumes ownership.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
@@ -79,8 +80,9 @@ pub trait IntoRawHandle {
|
|||||||
/// handle to the caller. When used in this way, callers are then the unique
|
/// handle to the caller. When used in this way, callers are then the unique
|
||||||
/// owners of the handle and must close it once it's no longer needed.
|
/// owners of the handle and must close it once it's no longer needed.
|
||||||
///
|
///
|
||||||
/// However, transferring ownership is not strictly required. See
|
/// However, transferring ownership is not strictly required. Use a
|
||||||
/// [`IntoHandle::into_handle`] for an API which strictly transfers ownership.
|
/// `Into<OwnedHandle>::into` implementation for an API which strictly
|
||||||
|
/// transfers ownership.
|
||||||
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
||||||
fn into_raw_handle(self) -> RawHandle;
|
fn into_raw_handle(self) -> RawHandle;
|
||||||
}
|
}
|
||||||
@@ -181,8 +183,9 @@ pub trait FromRawSocket {
|
|||||||
/// will take responsibility for closing it when the object goes out of
|
/// will take responsibility for closing it when the object goes out of
|
||||||
/// scope.
|
/// scope.
|
||||||
///
|
///
|
||||||
/// However, consuming ownership is not strictly required. See
|
/// However, consuming ownership is not strictly required. Use a
|
||||||
/// [`FromSocket::from_socket`] for an API which strictly consumes ownership.
|
/// `From<OwnedSocket>::from` implementation for an API which strictly
|
||||||
|
/// consumes ownership.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
@@ -205,8 +208,9 @@ pub trait IntoRawSocket {
|
|||||||
/// socket to the caller. When used in this way, callers are then the unique
|
/// socket to the caller. When used in this way, callers are then the unique
|
||||||
/// owners of the socket and must close it once it's no longer needed.
|
/// owners of the socket and must close it once it's no longer needed.
|
||||||
///
|
///
|
||||||
/// However, transferring ownership is not strictly required. See
|
/// However, transferring ownership is not strictly required. Use a
|
||||||
/// [`IntoSocket::into_socket`] for an API which strictly transfers ownership.
|
/// `Into<OwnedSocket>::into` implementation for an API which strictly
|
||||||
|
/// transfers ownership.
|
||||||
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
#[stable(feature = "into_raw_os", since = "1.4.0")]
|
||||||
fn into_raw_socket(self) -> RawSocket;
|
fn into_raw_socket(self) -> RawSocket;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user