pub trait AsSocket {
// Required method
fn as_socket(&self) -> BorrowedSocket<'_>;
}
Available on Windows only.
Expand description
A trait to borrow the socket from an underlying object.
Required Methods§
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> AsSocket for &T
impl<T: AsSocket> AsSocket for &mut T
impl<T: AsSocket> AsSocket for Box<T>
impl<T: AsSocket> AsSocket for Rc<T>
impl<T: AsSocket> AsSocket for Arc<T>
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> {}
Run