async-rs / async-rs/async-std

Clarify StreamExt::timeout() docs

Open
#800 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Rust
Stars
4.1k
Forks
339
PR merge metrics
No merged PRs in 30d

Description

The [description](https://docs.rs/async-std/1.6.0/async_std/prelude/trait.StreamExt.html#method.timeout) for `StreamExt::timeout()` states it will "await a stream or times out after a duration of time," but it's not clear whether it times out after the specified duration

1. since calling `timeout()`

or

2. since a stream item was last produced

I wanted #2 when I used this function, but then I realized it actually works like #1.

I noticed theres [a pull request](https://github.com/async-rs/async-std/pull/732) that adds a `timeout_repeat()` function that implements #2; the docs on both these functions should make it clear which of the above behaviors it implements.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.