Skip to main content

AsSocket

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.

Required Methods§

1.63.0 · Source

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

This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).

Borrows the socket.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

1.63.0 · Source§

impl AsSocket for BorrowedSocket<'_>

1.63.0 · Source§

impl AsSocket for OwnedSocket

1.63.0 · Source§

impl AsSocket for TcpListener

1.63.0 · Source§

impl AsSocket for TcpStream

1.63.0 · Source§

impl AsSocket for UdpSocket

Source§

impl AsSocket for UnixStream

Source§

impl<T: AsSocket + ?Sized> AsSocket for UniqueRc<T>

1.63.0 · Source§

impl<T: AsSocket> AsSocket for &T

1.63.0 · Source§

impl<T: AsSocket> AsSocket for &mut 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> {}
1.71.0 · Source§

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

1.71.0 · Source§

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