async-net icon indicating copy to clipboard operation
async-net copied to clipboard

Add I/O-safe traits

Open notgull opened this issue 3 years ago • 3 comments
trafficstars

This PR adds a new feature, io_safety, which requires Rust 1.63. With this feature, the types in this crate implement AsFd/AsSocket and TryFrom<OwnedFd/OwnedSocket>.

See also: sunfishcode/io-lifetimes#38

Should I also implement TryInto<OwnedFd/OwnedSocket> on these types? It would involve unwrapping the Arc, which doesn't feel idiomatic, but it would complete the symmetry with std.

notgull avatar Aug 11 '22 20:08 notgull

Should I also implement TryInto<OwnedFd/OwnedSocket> on these types? It would involve unwrapping the Arc, which doesn't feel idiomatic, but it would complete the symmetry with std.

Depending on how the standard library implements them, if we cannot provide the same behavior, I prefer not to do this since we are not providing the same API anyway.

taiki-e avatar Aug 12 '22 09:08 taiki-e

Can we just bump up the major version with the latest MSRV?

sehz avatar Aug 12 '22 18:08 sehz

Rewritten to use autocfg as per conversation here.

notgull avatar Aug 15 '22 13:08 notgull

Published in 1.7.0.

taiki-e avatar Aug 17 '22 20:08 taiki-e