1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use core::{
pin::Pin,
task::{Context, Poll},
};
mod addr;
mod ip;
mod parser;
#[cfg(feature = "std")]
mod std_impl;
pub use self::addr::{GetSocketAddrs, SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
pub use self::parser::AddrParseError;
#[cfg(feature = "std")]
pub use self::std_impl::*;
pub trait AsyncSendTo {
type Error;
fn poll_send_to(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
addr: SocketAddr,
) -> Poll<Result<usize, Self::Error>>;
}
pub trait AsyncRecvFrom {
type Error;
fn poll_recv_from(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &mut [u8],
) -> Poll<Result<(usize, SocketAddr), Self::Error>>;
}
pub trait MulticastSocket {
type Error;
fn join_multicast(&self, addr: IpAddr) -> Result<(), Self::Error>;
fn leave_multicast(&self, addr: IpAddr) -> Result<(), Self::Error>;
}