Crates.io | async-shared-timeout |
lib.rs | async-shared-timeout |
version | 0.2.2 |
source | src |
created_at | 2022-12-07 01:56:16.970596 |
updated_at | 2024-03-20 07:35:29.395245 |
description | Async timeout that can be reset and shared |
homepage | |
repository | https://github.com/chayleaf/async-shared-timeout/ |
max_upload_size | |
id | 731530 |
size | 32,152 |
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.
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
supportasync-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
).AsRawFd
support for Wrapper
Timeout::new_tokio
TokioTimeout
and TokioWrapper
type aliasesTL;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.