-
Notifications
You must be signed in to change notification settings - Fork 689
Use better types for all timeout arguments #516
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
Comments
I think part of the rationale was wanting to support old versions of Rust. |
If the type is stable in all supported Rust versions, definite +1 to using proper time/duration types as arguments. |
Yeah, no objection from me. |
This brings up an interesting point, both for users and developers, that the minimum supported rust version isn't explicitly stated anywhere, though your CI only tests Rust 1.7. Can this be added to the readme? |
That seems reasonable. I do believe we have tried to make a note of any changes to supported version in the changelog. |
1.7 is the current minimum, I believe. Re taking |
Why not just use Duration everywhere? #511 shows that if helper methods are desired they can just be implemented for Duration instead of introducing a new type. Or am I missing something and it's inappropriate or unergonomic in some cases? |
@posborne @kamalmarhubi Any comments on this? |
I agree that taking |
Would Rust be able to optimize across |
Regarding my comment above, it doesn't appear that Rust can reach through multiple
|
Some more notes:
|
I think this discussion should only attempt to address the |
I've started implementing this, and I think the easiest solution here is to replicate the |
@Susurrus any progress here? I could really use this and I'm willing to lent a hand to implement this. |
My progress is what you see tracked here; I started exploring this, but didn't go very far because I don't have a specific use case for it and our examples are trivial enough, so designing a better API here is mostly guesswork for me. If you have specific use case and can iterate on a nice API, I'd really appreciate you driving this issue. I think my last comments are the direction this should go, but I don't have much code that requires this kind of API so my testing abilities are limited. |
I currently need Should I create a PR that changes that? I know more function use timespec, but it will be a start at least. |
What I'd like to have is a zero-cost implementation for using the same datatype across different functions. So if you have a |
Created an intial PR in #838. |
It looks like there may be other work on this area from perusing the existing issues and PRs, so maybe this is covered by that work already, but I wanted to use a Duration (or equivalent) for
poll::poll()
. Looks like there are a number of functions that could use this type treatment:poll::poll()
event::kevent()
(though this looks like a backcompat issue)epoll::epoll_wait()
I'm not certain if there are rationales for why this hasn't been done already since it looks like some functions have been converted to use
TimeSpec
/TimeVal
already.The text was updated successfully, but these errors were encountered: