pub trait AsSocket {
// Required method
fn as_socket(&self) -> BorrowedSocket<'_>;
}
Expand description
A trait to borrow the socket from an underlying object.
Required Methods§
1.63.0 · Sourcefn as_socket(&self) -> BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
Borrows the socket.
Implementors§
impl AsSocket for TcpListener
impl AsSocket for TcpStream
impl AsSocket for UdpSocket
impl AsSocket for BorrowedSocket<'_>
impl AsSocket for OwnedSocket
impl<T> AsSocket for &Twhere
T: AsSocket,
impl<T> AsSocket for &mut Twhere
T: AsSocket,
impl<T> AsSocket for Box<T>where
T: AsSocket,
impl<T> AsSocket for Rc<T>where
T: AsSocket,
impl<T> AsSocket for Arc<T>where
T: AsSocket,
This impl allows implementing traits that require AsSocket
on Arc.
use std::net::UdpSocket;
use std::sync::Arc;
trait MyTrait: AsSocket {}
impl MyTrait for Arc<UdpSocket> {}
impl MyTrait for Box<UdpSocket> {}