-
Notifications
You must be signed in to change notification settings - Fork 67
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
Support creating an Async
with AsFd
rather than AsRawFd
#136
Conversation
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.
I can't speak for the other admins, but my preference at this point would be to just have a breaking change here rather than adding a new method. It's debatably unsafe to keep using AsRawFd
at this point, and I'd rather have that other another hard to maintain constructor.
@notgull That works for me. Happy to rework this into a major-version change instead. |
cc22957
to
8a6754e
Compare
@notgull Done. Note that this doesn't currently build because |
timerfd PR: https://github.com/main--/rust-timerfd/pull/13 |
inotify PR: hannobraun/inotify-rs#202 |
8a6754e
to
de7972c
Compare
I should probably ask. @smol-rs/admins Are we fine with a breaking change at this point? Note that |
Sure. However, I think most users out there will just keep using 1.0 w/o realizing that 1.x is no longer supported. The fix is super trivial though so no sure if it matters at all. 🤷 so tl'dr go for it. :) |
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.
No real objections now that Debian Bookworm is out. Once the errors are fixed we should be good to go.
7773a66
to
80774ea
Compare
Declare an MSRV of Rust 1.63 (available in the imminently releasing Debian stable version), and use the types unconditionally.
80774ea
to
b5bc5ae
Compare
I've rebased the current version, and updated to use a version of timerfd that builds with this change. |
…`AsRawFd` Modify the `Async::new` constructor to use `AsFd` rather than `AsRawFd` (or the socket equivalents on Windows). Modify other code accordingly. Drop impls of `AsRawFd` and `AsRawSocket`. Update timerfd dev-dependency to 1.5 so that the timerfd example still builds.
b5bc5ae
to
a0dee2a
Compare
FWIW, I don't know if a breaking change is the right approach here, either. That'd be required to change the Ultimately it's up to you, and I'll adapt this PR to whatever you'd like to do; I just don't want to give the impression of pushing for a breaking change, or being enthusiastic about one. :) |
There are some breaking changes we would like to make to some of the other smol-rs crates (re-export in futures-lite, seal ext traits in async-fs, default features in async-lock, etc.), so I am not opposed to releasing a smol 2.0 that includes them along with this change. That said, we need to consider the downstream impact of them. For example, async-std uses some smol-rs crates types as-is as public APIs, so a major version bump may be required for async-std to update to use the latest versions of them. |
I would be opposed to keeping around a constructor for |
AFAIK it's not considered a breaking change to mark an unsafe function as such so we should do that regardless (if the raw constructor is kept). |
It feel unidiomatic to have an unsafe |
I've created an issue on the main repo for further discussion of this, see smol-rs/smol#258 |
As far as I know, that's a breaking change; existing code won't compile anymore. |
True but my understanding is that since it notifies user of potential dangers (that they may not be aware of before), it is not considered a semver break by convention. Neither the relevant RFC nor Cargo references mention this explicitly though. 🤷 |
Superseded by #142 |
This adds support for creating an
Async
on a type that supportsAsFd
(
AsSocket
on Windows), without requiring the type to implementAsRawFd
(
AsRawSocket
on Windows).This builds on #135 . The first commit
is the same as that PR.
The second commit factors out an internal helper that contains most of the
logic of the
Async::new
constructor: setting the fd or socket tonon-blocking.
The third commit then adds the new constructor; using the helper, these are
only a few lines (plus the doc comments).