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 #134

Merged
merged 3 commits into from
Aug 24, 2022
Merged

Implement I/O safety traits #134

merged 3 commits into from
Aug 24, 2022

Conversation

notgull
Copy link
Contributor

@notgull notgull commented Aug 17, 2022

This pull request adds a new io_safety feature that uses the AsFd trait from Rust 1.63. In addition, the Fd utility type is implemented using OwnedFd for its niching.

See also: sunfishcode/io-lifetimes#38

src/sys/sys.rs Outdated Show resolved Hide resolved
src/util.rs Outdated
} else {
Err(())
/// An owned file descriptor.
pub struct Fd(pub OwnedFd);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make io_uring use OwnedFd directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this project's MSRV? I use the Fd wrapper to choose between OwnedFd and a version compatible with older versions of Rust. Using OwnedFd directly would bump the MSRV to 1.63.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have an explicit MSRV, but I really don't want to chase a compiler version that's too new.

We still have to provide a fallback impl, but the interface should be consistent with OwnedFd. After 1.63 is old enough, we can delete this fallback impl directly.

Copy link
Member

@quininer quininer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@quininer quininer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we also need to fix fmt

@quininer quininer merged commit 776c68c into tokio-rs:master Aug 24, 2022
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.

2 participants