pub trait UdpSocket: DnsUdpSocket {
// Required methods
fn connect<'async_trait>(
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait;
fn connect_with_bind<'async_trait>(
addr: SocketAddr,
bind_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait;
fn bind<'async_trait>(
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait;
}
Expand description
Trait for UdpSocket
Required Methods§
Sourcefn connect<'async_trait>(
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
fn connect<'async_trait>(
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
setups up a “client” udp connection that will only receive packets from the associated address
Sourcefn connect_with_bind<'async_trait>(
addr: SocketAddr,
bind_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
fn connect_with_bind<'async_trait>(
addr: SocketAddr,
bind_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
same as connect, but binds to the specified local address for sending address
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.
Implementations on Foreign Types§
Source§impl UdpSocket for UdpSocket
Available on crate feature tokio-runtime
only.
impl UdpSocket for UdpSocket
Available on crate feature
tokio-runtime
only.Source§fn connect<'async_trait>(
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
fn connect<'async_trait>(
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
sets up up a “client” udp connection that will only receive packets from the associated address
if the addr is ipv4 then it will bind local addr to 0.0.0.0:0, ipv6 [::]0
Source§fn connect_with_bind<'async_trait>(
_addr: SocketAddr,
bind_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
fn connect_with_bind<'async_trait>(
_addr: SocketAddr,
bind_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
same as connect, but binds to the specified local address for sending address