Trait unsafe_io::AsUnsafeSocket [−][src]
A trait for types which contain an unsafe socket and can expose it.
A type implementing AsUnsafeSocket
guarantees that the return value
from as_unsafe_socket
on an instance of the type is a copy of a socket
which is owned.
Safety
This trait is unsafe
because types implementing it must guarantee they
own their socket.
Required methods
fn as_unsafe_socket(&self) -> UnsafeSocket
[src]
Return the contained unsafe socket.
Provided methods
fn as_tcp_stream_view(&self) -> View<'_, TcpStream>
[src]
Utility for returning a value which dereferences to a &TcpStream
or
&mut TcpStream
.
Note that AsUnsafeSocket
may be implemented for types which are not
TCP streams, and which don’t support all the methods on TcpStream
.
unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>
[src]
Like as_tcp_stream_view
, but returns a value which is not explicitly
tied to the lifetime of self
.
Safety
Callers must manually ensure that the view doesn’t outlive self
.
fn as_tcp_listener_view(&self) -> View<'_, TcpListener>
[src]
Utility for returning a value which dereferences to a &TcpListener
or
&mut TcpListener
.
Note that AsUnsafeSocket
may be implemented for types which are not
TCP listeners, and which don’t support all the methods on
TcpListener
.
unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>
[src]
Like as_tcp_listener_view
, but returns a value which is not
explicitly tied to the lifetime of self
.
Safety
Callers must manually ensure that the view doesn’t outlive self
.
fn as_udp_socket_view(&self) -> View<'_, UdpSocket>
[src]
Utility for returning a value which dereferences to a &UdpSocket
or
&mut UdpSocket
.
Note that AsUnsafeSocket
may be implemented for types which are not
UDP sockets, and which don’t support all the methods on UdpSocket
.
unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>
[src]
Like as_udp_socket_view
, but returns a value which is not explicitly
tied to the lifetime of self
.
Safety
Callers must manually ensure that the view doesn’t outlive self
.
fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]
Utility for returning a value which dereferences to a &UnixStream
or
&mut UnixStream
.
Note that AsUnsafeSocket
may be implemented for types which are not
Unix-domain socket streams, and which don’t support all the methods on
UnixStream
.
unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>
[src]
Like as_unix_stream_view
, but returns a value which is not explicitly
tied to the lifetime of self
.
Safety
Callers must manually ensure that the view doesn’t outlive self
.
fn eq_socket<Socketlike: AsUnsafeSocket>(&self, other: &Socketlike) -> bool
[src]
Test whether self.as_unsafe_socket().as_unsafe_handle()
is equal to
other.as_unsafe_socket().as_unsafe_handle()
.
That this depends on the guarantee that types that implement
AsUnsafeSocket
own their resources, so we won’t erroneously compare
dangling handles.