Skip to main content

UdpSocketProvider

Trait UdpSocketProvider 

Source
pub trait UdpSocketProvider {
    type Sock: Socket<SocketAddr>;

    // Required method
    fn bind_new_udp_socket(
        &self,
        bound_addr: SocketAddr,
    ) -> impl Future<Output = Result<Self::Sock, SocketError>>;
}
Expand description

Provides access to UDP sockets.

Required Associated Types§

Source

type Sock: Socket<SocketAddr>

The type of sockets provided by this UdpSocketProvider.

Required Methods§

Source

fn bind_new_udp_socket( &self, bound_addr: SocketAddr, ) -> impl Future<Output = Result<Self::Sock, SocketError>>

Gets a UDP socket bound to the given address. The UDP socket should be allowed to send broadcast packets.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§