@@ -21,11 +21,13 @@ use std::task::{ready, Context, Poll};
21
21
/// the [`AsyncFd`] is dropped.
22
22
///
23
23
/// The [`AsyncFd`] takes ownership of an arbitrary object to represent the IO
24
- /// object. It is intended that this object will handle closing the file
24
+ /// object. It is intended that the inner object will handle closing the file
25
25
/// descriptor when it is dropped, avoiding resource leaks and ensuring that the
26
26
/// [`AsyncFd`] can clean up the registration before closing the file descriptor.
27
27
/// The [`AsyncFd::into_inner`] function can be used to extract the inner object
28
- /// to retake control from the tokio IO reactor.
28
+ /// to retake control from the tokio IO reactor. The [`OwnedFd`] type is often
29
+ /// used as the inner object, as it is the simplest type that closes the fd on
30
+ /// drop.
29
31
///
30
32
/// The inner object is required to implement [`AsRawFd`]. This file descriptor
31
33
/// must not change while [`AsyncFd`] owns the inner object, i.e. the
@@ -175,6 +177,7 @@ use std::task::{ready, Context, Poll};
175
177
/// [`TcpStream::poll_read_ready`]: struct@crate::net::TcpStream
176
178
/// [`AsyncRead`]: trait@crate::io::AsyncRead
177
179
/// [`AsyncWrite`]: trait@crate::io::AsyncWrite
180
+ /// [`OwnedFd`]: struct@std::os::fd::OwnedFd
178
181
pub struct AsyncFd < T : AsRawFd > {
179
182
registration : Registration ,
180
183
// The inner value is always present. the Option is required for `drop` and `into_inner`.
0 commit comments