AsSocket in std::os::windows::io - Rust (original) (raw)

Trait 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.

1.63.0 · Source

Borrows the socket.

1.63.0 · Source§

1.63.0 · Source§

1.63.0 · Source§

1.63.0 · Source§

1.63.0 · Source§

Source§

1.63.0 · Source§

1.63.0 · Source§

1.71.0 · Source§

1.71.0 · Source§

1.71.0 · Source§

This impl allows implementing traits that require AsSocket on Arc.

use std:🥅:UdpSocket;
use std::sync::Arc;

trait MyTrait: AsSocket {}
impl MyTrait for Arc<UdpSocket> {}
impl MyTrait for Box<UdpSocket> {}