Async-std: Add Future::timeout

Created on 20 Nov 2019  路  6Comments  路  Source: async-rs/async-std

Similar to future::timeout and Stream::timeout we should add a Future::timeout method.

We already have Future::delay, and timeout would be a great counterpart. This is similar to stdlib's max which is both an inherent method and a free function. Thanks!

enhancement good first issue

Most helpful comment

Sorry for the absence.
As I understood, I should add a new extension method to the Future trait?

All 6 comments

I like to take this if no one is working on it.

@miker1423 Go for it :)

Sorry for the absence.
As I understood, I should add a new extension method to the Future trait?

Here is the implementation https://github.com/miker1423/async-std/commit/c1f7be5d42f9fbeb63250e2b4f75986d2ae94fec, I know the docs are incomplete, I just wrote to take away the warning. Is this what was expected?

@miker1423 yeah that's in the right direction. I don't believe the pub modifiers are needed; pub(crate) should suffice. If you could submit the PR it'd make it easier to review. Thanks heaps for your work!

This should be closed with the merged PR #600, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yoshuawuyts picture yoshuawuyts  路  8Comments

humb1t picture humb1t  路  5Comments

imtsuki picture imtsuki  路  5Comments

95th picture 95th  路  7Comments

yoshuawuyts picture yoshuawuyts  路  6Comments