#[repr(transparent)]pub struct OwnedSocket {
socket: RawSocket,
}
Available on Windows only.
Expand description
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
.
Fields§
§socket: RawSocket
Implementations§
source§impl OwnedSocket
impl OwnedSocket
Trait Implementations§
source§impl AsRawSocket for OwnedSocket
impl AsRawSocket for OwnedSocket
source§fn as_raw_socket(&self) -> RawSocket
fn as_raw_socket(&self) -> RawSocket
Extracts the raw socket. Read more
source§impl AsSocket for OwnedSocket
impl AsSocket for OwnedSocket
source§fn as_socket(&self) -> BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
Borrows the socket.
source§impl Debug for OwnedSocket
impl Debug for OwnedSocket
source§impl Drop for OwnedSocket
impl Drop for OwnedSocket
source§impl From<OwnedSocket> for TcpListener
impl From<OwnedSocket> for TcpListener
source§fn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
Converts to this type from the input type.
source§impl From<OwnedSocket> for TcpStream
impl From<OwnedSocket> for TcpStream
source§fn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
Converts to this type from the input type.
source§impl From<OwnedSocket> for UdpSocket
impl From<OwnedSocket> for UdpSocket
source§fn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
Converts to this type from the input type.
source§impl From<TcpListener> for OwnedSocket
impl From<TcpListener> for OwnedSocket
source§fn from(tcp_listener: TcpListener) -> OwnedSocket
fn from(tcp_listener: TcpListener) -> OwnedSocket
Converts to this type from the input type.
source§impl From<TcpStream> for OwnedSocket
impl From<TcpStream> for OwnedSocket
source§fn from(tcp_stream: TcpStream) -> OwnedSocket
fn from(tcp_stream: TcpStream) -> OwnedSocket
Converts to this type from the input type.
source§impl From<UdpSocket> for OwnedSocket
impl From<UdpSocket> for OwnedSocket
source§fn from(udp_socket: UdpSocket) -> OwnedSocket
fn from(udp_socket: UdpSocket) -> OwnedSocket
Converts to this type from the input type.
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
Constructs a new I/O object from the specified raw socket. Read more
source§impl IntoRawSocket for OwnedSocket
impl IntoRawSocket for OwnedSocket
source§fn into_raw_socket(self) -> RawSocket
fn into_raw_socket(self) -> RawSocket
Consumes this object, returning the raw underlying socket. Read more
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more