Trait std::os::windows::io::socket::AsSocket

1.63.0 · source ·
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§

source

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

Borrows the socket.

Implementors§

source§

impl AsSocket for TcpListener

source§

impl AsSocket for TcpStream

source§

impl AsSocket for UdpSocket

source§

impl AsSocket for Socket

source§

impl AsSocket for BorrowedSocket<'_>

source§

impl AsSocket for OwnedSocket

source§

impl<T: AsSocket> AsSocket for &T

source§

impl<T: AsSocket> AsSocket for &mut T

1.71.0 · source§

impl<T: AsSocket> AsSocket for Box<T>

1.71.0 · source§

impl<T: AsSocket> AsSocket for Rc<T>

1.71.0 · source§

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