Struct std::os::windows::io::OwnedSocket

1.63.0 · source ·
#[repr(transparent)]
pub struct OwnedSocket { /* private fields */ }
Available on Windows only.
Expand description

一个拥有所有权的套接字。

这将丢弃时关闭套接字。

这使用 repr(transparent) 并具有主机套接字的表示形式,因此它可以在 FFI 中将套接字作为消耗参数传递或作为拥有值返回的地方使用,并且它永远不会具有值 INVALID_SOCKET

Implementations§

source§

impl OwnedSocket

source

pub fn try_clone(&self) -> Result<Self>

创建一个新的 OwnedSocket 实例,该实例与现有 OwnedSocket 实例共享相同的底层 object。

Trait Implementations§

source§

impl AsRawSocket for OwnedSocket

source§

fn as_raw_socket(&self) -> RawSocket

提取原始套接字。 Read more
source§

impl AsSocket for OwnedSocket

source§

fn as_socket(&self) -> BorrowedSocket<'_>

借用套接字。
source§

impl Debug for OwnedSocket

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

使用给定的格式化程序格式化该值。 Read more
source§

impl Drop for OwnedSocket

source§

fn drop(&mut self)

执行此类型的析构函数。 Read more
source§

impl From<OwnedSocket> for TcpListener

source§

fn from(owned: OwnedSocket) -> Self

从输入类型转换为此类型。
source§

impl From<OwnedSocket> for TcpStream

source§

fn from(owned: OwnedSocket) -> Self

从输入类型转换为此类型。
source§

impl From<OwnedSocket> for UdpSocket

source§

fn from(owned: OwnedSocket) -> Self

从输入类型转换为此类型。
source§

impl From<TcpListener> for OwnedSocket

source§

fn from(tcp_listener: TcpListener) -> OwnedSocket

从输入类型转换为此类型。
source§

impl From<TcpStream> for OwnedSocket

source§

fn from(tcp_stream: TcpStream) -> OwnedSocket

从输入类型转换为此类型。
source§

impl From<UdpSocket> for OwnedSocket

source§

fn from(udp_socket: UdpSocket) -> OwnedSocket

从输入类型转换为此类型。
source§

impl FromRawSocket for OwnedSocket

source§

unsafe fn from_raw_socket(socket: RawSocket) -> Self

从指定的原始套接字创建一个新的 I/O object。 Read more
source§

impl IntoRawSocket for OwnedSocket

source§

fn into_raw_socket(self) -> RawSocket

消耗此对象,返回原始底层套接字。 Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

获取 selfTypeIdRead more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

从拥有的值中一成不变地借用。 Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

从拥有的值中借用。 Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

返回未更改的参数。

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

调用 U::from(self)

也就是说,这种转换是 From<T> for U 实现选择执行的任何操作。

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

发生转换错误时返回的类型。
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

执行转换。
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

发生转换错误时返回的类型。
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

执行转换。