-
Notifications
You must be signed in to change notification settings - Fork 10
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
Update for io_safety being stabilized. #41
Conversation
io_safety is now [stable in Rust 1.63]! This PR updates io-lifetimes to use the standard library types and traits when available, and use its own types and traits on older Rust versions. The traits `FromFd` and `IntoFd` are now marked as deprecated. These are replaced by `From<OwnedFd>` and `From<...> for OwnedFd` in the standard library, and users should migrate accordingly. [stable in Rust 1.63]: https://blog.rust-lang.org/2022/08/11/Rust-1.63.0.html#rust-ownership-for-raw-file-descriptorshandles-io-safety
And, migrate the portability types and traits to use `From<OwnedFd>` and `Into<OwnedFd>`.
This allows the `from_into_fd` extension to continue working, for now.
This will be a semver-incompatible change. And since the main types and traits are stablized now, I think it makes sense to make this a 1.0 release. |
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.
Looks good to me, this is getting exciting
src/traits.rs
Outdated
@@ -102,6 +102,10 @@ pub trait IntoHandle { | |||
/// let owned_handle: OwnedHandle = f.into_handle(); | |||
/// # Ok::<(), io::Error>(()) | |||
/// ``` | |||
#[deprecated( |
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.
Should a deprecation notice be attached to the traits 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.
Good spot, yes, we can deprecate IntoFd
and related traits.
I didn't mark FromFd
and friends as deprecated yet, because they have the from_into_fd
utility functions, which some users use and find handy. Fortunately, it's just a blanket impl for any type that implements From<OwnedFd>
, so it's not something users need to implement themselves.
This PR isn't deprecating `FromFd` yet, because it provides the `from_into_fd` utility.
io_safety is now stable in Rust 1.63! This PR updates io-lifetimes to
use the standard library types and traits when available, and use its
own types and traits on older Rust versions.
The traits
FromFd
andIntoFd
are now marked as deprecated. These arereplaced by
From<OwnedFd>
andFrom<...> for OwnedFd
in the standardlibrary, and users should migrate accordingly.