Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AsyncFd::new return inner on error #6344

Closed
Hurricane996 opened this issue Feb 13, 2024 · 0 comments · Fixed by #6345
Closed

Make AsyncFd::new return inner on error #6344

Hurricane996 opened this issue Feb 13, 2024 · 0 comments · Fixed by #6345
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-io Module: tokio/io

Comments

@Hurricane996
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-io Module: tokio/io
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants