Crates.io | yield-progress |
lib.rs | yield-progress |
version | 0.1.7 |
source | src |
created_at | 2023-08-23 22:02:33.795932 |
updated_at | 2024-06-30 20:38:20.104568 |
description | Combined progress reporting and cooperative task yielding. |
homepage | |
repository | https://github.com/kpreid/yield-progress |
max_upload_size | |
id | 952771 |
size | 63,417 |
YieldProgress
This library, yield-progress
, provides the YieldProgress
type, which allows a long-running async task to report its progress, while also yielding to the scheduler (e.g. for the single-threaded web/Wasm environment) and introducing cancellation points.
These things go together because the rate at which it makes sense to yield (to avoid event loop hangs) is similar to the rate at which it makes sense to report progress, at least for human interfaces.
YieldProgress
is executor-independent; when it is constructed, the caller may provide a function
for yielding using executor-specific mechanisms such as tokio::task::yield_now()
,
or may use the built-in simple yielder.no_std
compatible if default features are disabled.
See the library documentation for details on the consequences.yield-progress
has been split out of my larger project all-is-cubes
so that I can use it for other applications; its functionality and applicability may be limited, but I believe it is free of bugs.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.