Skip to main content

AsSocketRef

Trait AsSocketRef 

pub trait AsSocketRef {
    // Required method
    fn as_socket_ref(&self) -> SockRef<'_>;
}
Available on crate feature net only.
Expand description

Borrow a platform socket as a SockRef.

Implementations are intentionally limited to socket types. A blanket over AsFd would also admit regular files, terminals, and pipes even though those descriptors cannot accept socket options.

Required Methods§

fn as_socket_ref(&self) -> SockRef<'_>

Return a non-owning reference to this socket.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl AsSocketRef for TcpListener

§

fn as_socket_ref(&self) -> SockRef<'_>

§

impl AsSocketRef for TcpListener

§

fn as_socket_ref(&self) -> SockRef<'_>

§

impl AsSocketRef for TcpStream

§

fn as_socket_ref(&self) -> SockRef<'_>

§

impl AsSocketRef for UdpSocket

§

fn as_socket_ref(&self) -> SockRef<'_>

Implementors§

§

impl AsSocketRef for Socket

§

impl AsSocketRef for rama::tcp::TokioTcpStream

§

impl AsSocketRef for rama::tcp::TcpStream

Available on target_family=unix or Windows only.
§

impl AsSocketRef for rama::udp::UdpSocket