Struct OwnedSocket

struct OwnedSocket { ... }

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

impl OwnedSocket

fn try_clone(self: &Self) -> io::Result<Self>

Creates a new OwnedSocket instance that shares the same underlying object as the existing OwnedSocket instance.

impl AsRawSocket for OwnedSocket

fn as_raw_socket(self: &Self) -> RawSocket

impl AsSocket for OwnedSocket

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

impl Debug for OwnedSocket

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

impl Drop for OwnedSocket

fn drop(self: &mut Self)

impl Freeze for OwnedSocket

impl From for OwnedSocket

fn from(tcp_stream: crate::net::TcpStream) -> OwnedSocket

Takes ownership of a TcpStream's socket.

impl From for OwnedSocket

fn from(tcp_listener: crate::net::TcpListener) -> OwnedSocket

Takes ownership of a TcpListener's socket.

impl From for OwnedSocket

fn from(udp_socket: crate::net::UdpSocket) -> OwnedSocket

Takes ownership of a UdpSocket's underlying socket.

impl FromRawSocket for OwnedSocket

unsafe fn from_raw_socket(socket: RawSocket) -> Self

impl IntoRawSocket for OwnedSocket

fn into_raw_socket(self: Self) -> RawSocket

impl RefUnwindSafe for OwnedSocket

impl Send for OwnedSocket

impl Sync for OwnedSocket

impl Unpin for OwnedSocket

impl UnwindSafe for OwnedSocket

impl<T> Any for OwnedSocket

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for OwnedSocket

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for OwnedSocket

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

impl<T> From for OwnedSocket

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for OwnedSocket

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for OwnedSocket

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

impl<T, U> TryInto for OwnedSocket

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