-
Notifications
You must be signed in to change notification settings - Fork 741
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
Implement I/O safety traits #1745
Conversation
examples/tcp_listenfd_server.rs
Outdated
#[cfg(unix)] | ||
use std::os::unix::io::FromRawFd; | ||
#[cfg(target_os = "wasi")] | ||
use std::os::wasi::io::FromRawFd; | ||
#[cfg(any(unix, target_os = "wasi"))] | ||
use std::os::fd::FromRawFd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module is rather new, so this change may conflict with decreasing the MSRV as discussed in #1732. Maybe just introduce your own module for this functionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::os::fd
is from Rust 1.66, in #1749 we'll need a MSRV of 1.71 (?), so this won't make the difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we also have Hermit, this makes the implementations a lot simpler.
ba9fa9f
to
ea72027
Compare
32884de
to
d06e264
Compare
@Darksonn rebased this as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. It's nice that the LOWEST_FD
logic can be moved into std.
Co-authored-by: ssrlive <[email protected]>
Instead of std::os::unix. It also works on WASM/WASI.
The AsFd, AsRawFd, FromRawFd and IntoRawFd traits. For WASI this was not implemented for all public types, now it is (matching Unix).
d06e264
to
5ca5e25
Compare
This reverts commit ac36f51. Tokio now supports IO Safety: tokio-rs/mio#1745
Closes #1588