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

Implement I/O safety traits #1745

Merged
merged 4 commits into from
Jun 9, 2024
Merged

Implement I/O safety traits #1745

merged 4 commits into from
Jun 9, 2024

Conversation

Thomasdezeeuw
Copy link
Collaborator

Closes #1588

This was referenced Dec 23, 2023
Comment on lines 22 to 23
#[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;
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

@Thomasdezeeuw
Copy link
Collaborator Author

@Darksonn rebased this as well.

Copy link
Contributor

@Darksonn Darksonn left a 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.

Thomasdezeeuw and others added 4 commits June 9, 2024 15:57
Co-authored-by: ssrlive <30760636+ssrlive@users.noreply.github.com>
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).
@Thomasdezeeuw Thomasdezeeuw merged commit 5200f6c into master Jun 9, 2024
31 checks passed
@Thomasdezeeuw Thomasdezeeuw deleted the thomas/1588 branch June 9, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to I/O safety traits
2 participants