Skip to content

Implement I/O-safe traits #84

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

Merged
merged 6 commits into from
Aug 17, 2022
Merged

Implement I/O-safe traits #84

merged 6 commits into from
Aug 17, 2022

Conversation

notgull
Copy link
Member

@notgull notgull commented Aug 11, 2022

This PR implements AsFd and AsSocket for Async<T>. In addition, TryFrom<OwnedFd/OwnedSocket is implemented for Async<T> and TryFrom<Async<T>> is implemented for OwnedFd/OwnedSocket, in order to mirror the From/Into<OwnedFd/OwnedSocket> impls in std but also considering that the operations are fallible in async-io.

See also: sunfishcode/io-lifetimes#38

Copy link
Collaborator

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks! This looks good to me.

Copy link
Collaborator

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks!

@taiki-e taiki-e merged commit a20076f into smol-rs:master Aug 17, 2022
@taiki-e
Copy link
Collaborator

taiki-e commented Aug 17, 2022

Published in 1.8.0.

jk-ozlabs added a commit to jk-ozlabs/async-io that referenced this pull request Aug 4, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with a
cfg(has_pipe), and use autocfg to set has_pipe, like was done in a20076f
("Implement I/O-safe traits (smol-rs#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
jk-ozlabs added a commit to jk-ozlabs/async-io that referenced this pull request Aug 4, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with a
cfg(has_pipe), and use autocfg to set has_pipe, like was done in a20076f
("Implement I/O-safe traits (smol-rs#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
jk-ozlabs added a commit to jk-ozlabs/async-io that referenced this pull request Aug 4, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with cfg()s
and use autocfg to detect the type availbility, similar to what was done
in a20076f ("Implement I/O-safe traits (smol-rs#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
jk-ozlabs added a commit to jk-ozlabs/async-io that referenced this pull request Aug 4, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with cfg()s
and use autocfg to detect the type availbility, similar to what was done
in a20076f ("Implement I/O-safe traits (smol-rs#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
jk-ozlabs added a commit to jk-ozlabs/async-io that referenced this pull request Aug 4, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with cfg()s
and use autocfg to detect the type availbility, similar to what was done
in a20076f ("Implement I/O-safe traits (smol-rs#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
jk-ozlabs added a commit to jk-ozlabs/async-io that referenced this pull request Aug 5, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with cfg()s
and use autocfg to detect the type availbility, similar to what was done
in a20076f ("Implement I/O-safe traits (smol-rs#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
jk-ozlabs added a commit to jk-ozlabs/async-io that referenced this pull request Aug 5, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with cfg()s
and use autocfg to detect the type availbility, similar to what was done
in a20076f ("Implement I/O-safe traits (smol-rs#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
taiki-e pushed a commit that referenced this pull request Aug 5, 2025
It would be handy to have async wrappers for the pipe types (from
std::io::pipe()), so impl IoSafe for both.

The pipe types were introduced in 1.87, but the MSRV for async-io
appears to be 1.63 currently. So, protect the impls with cfg()s
and use autocfg to detect the type availability, similar to what was done
in a20076f ("Implement I/O-safe traits (#84)")

Signed-off-by: Jeremy Kerr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants