#[repr(transparent)]pub struct OwnedSocket { /* private fields */ }
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
.
Implementations
sourceimpl OwnedSocket
impl OwnedSocket
Trait Implementations
sourceimpl AsRawSocket for OwnedSocket
impl AsRawSocket for OwnedSocket
sourcefn as_raw_socket(&self) -> RawSocket
fn as_raw_socket(&self) -> RawSocket
Extracts the underlying raw socket from this object.
sourceimpl AsSocket for OwnedSocket
impl AsSocket for OwnedSocket
sourceimpl Debug for OwnedSocket
impl Debug for OwnedSocket
sourceimpl Drop for OwnedSocket
impl Drop for OwnedSocket
sourceimpl From<OwnedSocket> for TcpStream
impl From<OwnedSocket> for TcpStream
sourcefn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
Performs the conversion.
sourceimpl From<OwnedSocket> for TcpListener
impl From<OwnedSocket> for TcpListener
sourcefn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
Performs the conversion.
sourceimpl From<OwnedSocket> for UdpSocket
impl From<OwnedSocket> for UdpSocket
sourcefn from(owned: OwnedSocket) -> Self
fn from(owned: OwnedSocket) -> Self
Performs the conversion.
sourceimpl From<TcpListener> for OwnedSocket
impl From<TcpListener> for OwnedSocket
sourcefn from(tcp_listener: TcpListener) -> OwnedSocket
fn from(tcp_listener: TcpListener) -> OwnedSocket
Performs the conversion.
sourceimpl From<TcpStream> for OwnedSocket
impl From<TcpStream> for OwnedSocket
sourcefn from(tcp_stream: TcpStream) -> OwnedSocket
fn from(tcp_stream: TcpStream) -> OwnedSocket
Performs the conversion.
sourceimpl From<UdpSocket> for OwnedSocket
impl From<UdpSocket> for OwnedSocket
sourcefn from(udp_socket: UdpSocket) -> OwnedSocket
fn from(udp_socket: UdpSocket) -> OwnedSocket
Performs the conversion.
sourceimpl FromRawSocket for OwnedSocket
impl FromRawSocket for OwnedSocket
sourceunsafe fn from_raw_socket(socket: RawSocket) -> Self
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
.
sourceimpl IntoRawSocket for OwnedSocket
impl IntoRawSocket for OwnedSocket
sourcefn 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more