#timeout #tokio #sleep #shared #async #stream #reset

no-std async-shared-timeout

Async timeout that can be reset and shared

5 releases

0.2.2 Mar 20, 2024
0.2.1 Mar 19, 2024
0.2.0 Dec 7, 2022
0.1.1 Dec 7, 2022
0.1.0 Dec 7, 2022

#260 in Asynchronous

Download history 89/week @ 2024-07-21 234/week @ 2024-07-28 163/week @ 2024-08-04 293/week @ 2024-08-11 402/week @ 2024-08-18 398/week @ 2024-08-25 221/week @ 2024-09-01 245/week @ 2024-09-08 834/week @ 2024-09-15 372/week @ 2024-09-22 250/week @ 2024-09-29 120/week @ 2024-10-06 223/week @ 2024-10-13 252/week @ 2024-10-20 96/week @ 2024-10-27 106/week @ 2024-11-03

693 downloads per month
Used in overtls

0BSD OR MIT OR Apache-2.0

30KB
575 lines

crates.io docs.rs

Async Shared Timeout

A Rust crate for creating a shared timeout. A sample use case is having multiple streams open from the client, and expiring them only when all of them stopped sending data. Another example is a proxy with a timeout - the proxy times out only when both the local and the remote ends time out.

Feature flags:

Wrapper

  • wrapper - enable a wrapper around types that you can use for easier resetting. By default, only future support is enabled (reset the timer upon future completion).
  • read-write - enable async Read/Write trait support for the wrapper (reset the timer upon successful read/write operations)
  • stream - enable Stream support for the wrapper (reset the timer upon stream advancement).

Integration with other runtimes

  • std (enabled by default) - enable std integration. Currently it's only used to enable Arc and AsRawFd support for the wrapper.
  • tokio (enabled by default) - tokio support
  • async-io - support async-io as the timer runtime.
  • futures-io - support futures-io traits.
  • async-std - async-std support (enables async-io and futures-io).

Changelog

  • 0.1.0 - initial release
  • 0.1.1 - AsRawFd support for Wrapper
  • 0.2.0 - minor API cleanup
  • 0.2.1 - updated dependencies, added Timeout::new_tokio
  • 0.2.2 - add TokioTimeout and TokioWrapper type aliases

License

TL;DR do whatever you want.

Licensed under either the BSD Zero Clause License (https://opensource.org/licenses/0BSD), the Apache 2.0 License (http://www.apache.org/licenses/LICENSE-2.0) or the MIT License (http://opensource.org/licenses/MIT), at your choice.

Dependencies

~3–13MB
~161K SLoC