Make AsyncFd::new return inner on error #6344
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
M-io
Module: tokio/io
Is your feature request related to a problem? Please describe.
This is required for a fix of emberian/evdev#144. The TLDR is that right now, if you call AsyncFd::new and it fails, the inner type is dropped with no way to access it. This means if you need any data off of the inner type for error handling, you have to clone it before calling AsyncFd::new(). This leads to an unnecessary clone.
Describe the solution you'd like
I'd like to see a custom error type consisting of the underlying io::Error as well as the original inner that was passed in so that I can grab information off of it when necessary for error handling
Describe alternatives you've considered
Because AsyncFd::new() has to take ownership and we don't want to require the inner type impl Clone, this seems like the only real solution to the problem.
Additional context
n/a
The text was updated successfully, but these errors were encountered: