-
Notifications
You must be signed in to change notification settings - Fork 156
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
Consider renaming Async::new() #36
Comments
What about removing the |
Maybe instead of "socket", "pollable fd" would be a better term? It seems weird to call the various other kinds of pollable fds on Linux "sockets" :)
This also seems like a good reason to rename, as one might want to add an |
stdio/out/err are actually pollable or not (just not on Windows)? I remember doing that quite a few times. |
@stjepang As long as the |
How about |
That of course depends on what your stdio streams happen to be. If they're on-disk files, they're not pollable. If they're ptys, or sockets, or pipes, they are 🙂 So it's definitely true that you cannot assume they're always pollable. |
Perhaps |
I decided to not change this :) It seems that the original issue hasn't come up again since the initial release of smol. That may be partly because more people have become familiarized with |
Since
Async::new()
should really only be used for networking and not for stdin/stderr/stdout/files, what if we renamedAsync::new()
toAsync::socket()
to prevent people from putting files etc. insideAsync
and expecting things to work?That said, there are some things that aren't sockets and can be used with
Async
like timerfd and notify, but we can say those are socket-like things.On Windows,
Async::new()
only acceptsT: AsRawSocket
so you really can only use sockets with it - the situation there is perfect. On Unix, there's justAsRawFd
and there's not really any way to distinguish between sockets and other kinds of file descriptors.The text was updated successfully, but these errors were encountered: