@@ -9,7 +9,13 @@ pub(crate) use io_lifetimes::OwnedSocket as OwnedFd;
9
9
pub use std:: os:: windows:: io:: RawSocket as RawFd ;
10
10
pub ( crate ) use winapi:: um:: winsock2:: SOCKET as LibcFd ;
11
11
12
+ /// A version of [`AsRawFd`] for use with Winsock APIs.
13
+ ///
14
+ /// [`AsRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.AsRawFd.html
12
15
pub trait AsRawFd {
16
+ /// A version of [`as_raw_fd`] for use with Winsock APIs.
17
+ ///
18
+ /// [`as_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.as_raw_fd
13
19
fn as_raw_fd ( & self ) -> RawFd ;
14
20
}
15
21
#[ cfg( feature = "std" ) ]
@@ -20,7 +26,13 @@ impl<T: std::os::windows::io::AsRawSocket> AsRawFd for T {
20
26
}
21
27
}
22
28
29
+ /// A version of [`IntoRawFd`] for use with Winsock APIs.
30
+ ///
31
+ /// [`IntoRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.IntoRawFd.html
23
32
pub trait IntoRawFd {
33
+ /// A version of [`into_raw_fd`] for use with Winsock APIs.
34
+ ///
35
+ /// [`into_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.into_raw_fd
24
36
fn into_raw_fd ( self ) -> RawFd ;
25
37
}
26
38
#[ cfg( feature = "std" ) ]
@@ -31,7 +43,13 @@ impl<T: std::os::windows::io::IntoRawSocket> IntoRawFd for T {
31
43
}
32
44
}
33
45
46
+ /// A version of [`FromRawFd`] for use with Winsock APIs.
47
+ ///
48
+ /// [`FromRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html
34
49
pub trait FromRawFd {
50
+ /// A version of [`from_raw_fd`] for use with Winsock APIs.
51
+ ///
52
+ /// [`from_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.from_raw_fd
35
53
unsafe fn from_raw_fd ( raw_fd : RawFd ) -> Self ;
36
54
}
37
55
#[ cfg( feature = "std" ) ]
@@ -42,6 +60,9 @@ impl<T: std::os::windows::io::FromRawSocket> FromRawFd for T {
42
60
}
43
61
}
44
62
63
+ /// A version of [`AsFd`] for use with Winsock APIs.
64
+ ///
65
+ /// [`AsFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.AsFd.html
45
66
pub use io_lifetimes:: AsSocket as AsFd ;
46
67
47
68
/// We define `AsFd` as an alias for `AsSocket`, but that doesn't provide
@@ -57,7 +78,13 @@ impl<T: io_lifetimes::AsSocket> AsSocketAsFd for T {
57
78
}
58
79
}
59
80
81
+ /// A version of [`IntoFd`] for use with Winsock APIs.
82
+ ///
83
+ /// [`IntoFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.IntoFd.html
60
84
pub trait IntoFd {
85
+ /// A version of [`into_fd`] for use with Winsock APIs.
86
+ ///
87
+ /// [`into_fd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.IntoFd.html#tymethod.into_fd
61
88
fn into_fd ( self ) -> OwnedFd ;
62
89
}
63
90
impl < T : io_lifetimes:: IntoSocket > IntoFd for T {
@@ -67,7 +94,13 @@ impl<T: io_lifetimes::IntoSocket> IntoFd for T {
67
94
}
68
95
}
69
96
97
+ /// A version of [`FromFd`] for use with Winsock APIs.
98
+ ///
99
+ /// [`FromFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.FromFd.html
70
100
pub trait FromFd {
101
+ /// A version of [`from_fd`] for use with Winsock APIs.
102
+ ///
103
+ /// [`from_fd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.FromFd.html#tymethod.from_fd
71
104
fn from_fd ( fd : OwnedFd ) -> Self ;
72
105
}
73
106
impl < T : io_lifetimes:: FromSocket > FromFd for T {
0 commit comments