Skip to content

Commit

Permalink
Revert "make API more ergonomic"
Browse files Browse the repository at this point in the history
This reverts commit 87c864f.
  • Loading branch information
folkertdev committed Mar 22, 2023
1 parent 6e10e2f commit 63bfac0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tokio/src/io/async_fd.rs
Expand Up @@ -559,7 +559,7 @@ impl<T: AsRawFd> AsyncFd<T> {
/// let async_fd = AsyncFd::new(socket)?;
///
/// let written = async_fd
/// .async_io(Interest::WRITABLE, |inner| inner.send(&[1, 2]))
/// .async_io(Interest::WRITABLE, || async_fd.get_ref().send(&[1, 2]))
/// .await?;
///
/// println!("wrote {written} bytes");
Expand Down Expand Up @@ -596,11 +596,9 @@ impl<T: AsRawFd> AsyncFd<T> {
pub async fn async_io<R>(
&self,
interest: Interest,
mut f: impl FnMut(&T) -> io::Result<R>,
f: impl FnMut() -> io::Result<R>,
) -> io::Result<R> {
self.registration
.async_io(interest, || f(self.get_ref()))
.await
self.registration.async_io(interest, f).await
}
}

Expand Down

0 comments on commit 63bfac0

Please sign in to comment.