Struct std::os::windows::io::OwnedSocket
#[repr(transparent)]pub struct OwnedSocket { /* fields omitted */ }
An owned socket.
This closes the socket on drop.
This uses repr(transparent)
and has the representation of a host socket, so it can be used in FFI in places where a socket is passed as a consumed argument or returned as an owned value, and it never has the value INVALID_SOCKET
.
Trait Implementations
impl AsRawSocket for OwnedSocket
fn as_raw_socket(&self) -> RawSocket
Extracts the underlying raw socket from this object.
impl AsSocket for OwnedSocket
fn as_socket(&self) -> BorrowedSocket<'_>
Borrows the socket.
impl Debug for OwnedSocket
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the value using the given formatter. Read more
impl Drop for OwnedSocket
impl From<OwnedSocket> for TcpStream
fn from(owned: OwnedSocket) -> Self
Performs the conversion.
impl From<OwnedSocket> for TcpListener
fn from(owned: OwnedSocket) -> Self
Performs the conversion.
impl From<OwnedSocket> for UdpSocket
fn from(owned: OwnedSocket) -> Self
Performs the conversion.
impl From<TcpListener> for OwnedSocket
fn from(tcp_listener: TcpListener) -> OwnedSocket
Performs the conversion.
impl From<TcpStream> for OwnedSocket
fn from(tcp_stream: TcpStream) -> OwnedSocket
Performs the conversion.
impl From<UdpSocket> for OwnedSocket
fn from(udp_socket: UdpSocket) -> OwnedSocket
Performs the conversion.
impl FromRawSocket for OwnedSocket
unsafe fn from_raw_socket(socket: RawSocket) -> Self
Constructs a new instance of Self
from the given raw socket.
Safety
The resource pointed to by socket
must be open and suitable for assuming ownership. The resource must not require cleanup other than closesocket
.
impl IntoRawSocket for OwnedSocket
Auto Trait Implementations
impl RefUnwindSafe for OwnedSocket
impl Send for OwnedSocket
impl Sync for OwnedSocket
impl Unpin for OwnedSocket
impl UnwindSafe for OwnedSocket
Blanket Implementations
impl<T> From<T> for T
pub fn from(t: T) -> T
Performs the conversion.
pub fn into(self) -> U
Performs the conversion.
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/windows/io/struct.OwnedSocket.html