Skip to main content

UdpAdoptStd

Trait UdpAdoptStd 

Source
pub trait UdpAdoptStd: UdpBind {
    // Required method
    fn adopt(&self, s: UdpSocket) -> Result<Self::Socket>;
}
Expand description

Adopt an already-created std::net::UdpSocket.

The same split TcpAdoptStd makes over TcpConnect, for the same reason: on platforms with descriptors the socket options are applied once, outside the runtime, and the runtime only adopts the result — so every runtime crate does not rewrite the same setsockopt rigmarole. A runtime with no descriptor to adopt says so by not implementing this trait, which is how the seam already expresses that fact for TCP.

Required Methods§

Source

fn adopt(&self, s: UdpSocket) -> Result<Self::Socket>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§