#[repr(transparent)]pub struct OwnedSocket { /* private fields */ }
Available on Windows only.
Expand description
一个拥有所有权的套接字。
这将丢弃时关闭套接字。
这使用 repr(transparent)
并具有主机套接字的表示形式,因此它可以在 FFI 中将套接字作为消耗参数传递或作为拥有值返回的地方使用,并且它永远不会具有值 INVALID_SOCKET
。
Implementations§
Trait Implementations§
source§impl AsRawSocket for OwnedSocket
impl AsRawSocket for OwnedSocket
source§fn as_raw_socket(&self) -> RawSocket
fn as_raw_socket(&self) -> RawSocket
提取原始套接字。 Read more
source§impl AsSocket for OwnedSocket
impl AsSocket for OwnedSocket
source§fn as_socket(&self) -> BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
借用套接字。
source§impl Debug for OwnedSocket
impl Debug for OwnedSocket
source§impl From<OwnedSocket> for TcpListener
impl From<OwnedSocket> for TcpListener
source§fn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
从输入类型转换为此类型。
source§impl From<OwnedSocket> for TcpStream
impl From<OwnedSocket> for TcpStream
source§fn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
从输入类型转换为此类型。
source§impl From<OwnedSocket> for UdpSocket
impl From<OwnedSocket> for UdpSocket
source§fn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
从输入类型转换为此类型。
source§impl From<TcpListener> for OwnedSocket
impl From<TcpListener> for OwnedSocket
source§fn from(tcp_listener: TcpListener) -> OwnedSocket
fn from(tcp_listener: TcpListener) -> OwnedSocket
从输入类型转换为此类型。
source§impl From<TcpStream> for OwnedSocket
impl From<TcpStream> for OwnedSocket
source§fn from(tcp_stream: TcpStream) -> OwnedSocket
fn from(tcp_stream: TcpStream) -> OwnedSocket
从输入类型转换为此类型。
source§impl From<UdpSocket> for OwnedSocket
impl From<UdpSocket> for OwnedSocket
source§fn from(udp_socket: UdpSocket) -> OwnedSocket
fn from(udp_socket: UdpSocket) -> OwnedSocket
从输入类型转换为此类型。
source§impl FromRawSocket for OwnedSocket
impl FromRawSocket for OwnedSocket
source§unsafe fn from_raw_socket(socket: RawSocket) -> Self
unsafe fn from_raw_socket(socket: RawSocket) -> Self
从指定的原始套接字创建一个新的 I/O object。 Read more
source§impl IntoRawSocket for OwnedSocket
impl IntoRawSocket for OwnedSocket
source§fn into_raw_socket(self) -> RawSocket
fn into_raw_socket(self) -> RawSocket
消耗此对象,返回原始底层套接字。 Read more