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 AsFd for &T and &mut T. #18

Merged
merged 2 commits into from
Feb 15, 2022
Merged

Conversation

sunfishcode
Copy link
Owner

This ports rust-lang/rust#93888 to io-lifetimes.

@sunfishcode
Copy link
Owner Author

The tests using std's types and traits tests depend on #93888 landing in nightly.

@sunfishcode sunfishcode merged commit 53b0ed1 into main Feb 15, 2022
@sunfishcode sunfishcode deleted the sunfishcode/impl-asfd-for-ref branch February 15, 2022 18:30
sunfishcode added a commit to bytecodealliance/rustix that referenced this pull request Feb 16, 2022
With rust-lang/rust#93888 now in nightly, and sunfishcode/io-lifetimes#18 now
in io-lifetimes 0.5.2, we can now simplify the `AsFd` pattern from
`fn foo<Fd: AsFd>(fd: &Fd)` to `fn foo<Fd: AsFd>(fd: Fd)`, without the `&`.

This also follows the emerging convention in std, as seen in the new
[`fchown`] function.

This means that users can now pass `BorrowedFd` values directly to
functions that expect `AsFd` arguments, without having to write an
extra `&` when passing them.

[`fchown`]: https://doc.rust-lang.org/nightly/std/os/unix/fs/fn.fchown.html
sunfishcode added a commit to bytecodealliance/rustix that referenced this pull request Feb 16, 2022
With rust-lang/rust#93888 now in nightly, and sunfishcode/io-lifetimes#18 now
in io-lifetimes 0.5.2, we can now simplify the `AsFd` pattern from
`fn foo<Fd: AsFd>(fd: &Fd)` to `fn foo<Fd: AsFd>(fd: Fd)`, without the `&`.

This also follows the emerging convention in std, as seen in the new
[`fchown`] function.

This means that users can now pass `BorrowedFd` values directly to
functions that expect `AsFd` arguments, without having to write an
extra `&` when passing them.

[`fchown`]: https://doc.rust-lang.org/nightly/std/os/unix/fs/fn.fchown.html
sunfishcode added a commit to bytecodealliance/rustix that referenced this pull request Feb 17, 2022
With rust-lang/rust#93888 now in nightly, and sunfishcode/io-lifetimes#18 now
in io-lifetimes 0.5.2, we can now simplify the `AsFd` pattern from
`fn foo<Fd: AsFd>(fd: &Fd)` to `fn foo<Fd: AsFd>(fd: Fd)`, without the `&`.

This also follows the emerging convention in std, as seen in the new
[`fchown`] function.

This means that users can now pass `BorrowedFd` values directly to
functions that expect `AsFd` arguments, without having to write an
extra `&` when passing them.

[`fchown`]: https://doc.rust-lang.org/nightly/std/os/unix/fs/fn.fchown.html
sunfishcode added a commit to sunfishcode/io-extras that referenced this pull request Feb 17, 2022
Update to io-lifetimes 0.5.2 and `impl AsFd for &T` support added in
rust-lang/rust#93888 and sunfishcode/io-lifetimes#18.
sunfishcode added a commit to sunfishcode/io-extras that referenced this pull request Feb 17, 2022
Update to io-lifetimes 0.5.2 and `impl AsFd for &T` support added in
rust-lang/rust#93888 and sunfishcode/io-lifetimes#18.
sunfishcode added a commit to sunfishcode/io-extras that referenced this pull request Mar 15, 2022
Update to io-lifetimes 0.5.2 and `impl AsFd for &T` support added in
rust-lang/rust#93888 and sunfishcode/io-lifetimes#18.
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.

1 participant