Crate yield_progress
source ·Expand description
This library 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.
YieldProgress
is executor-independent; when it is constructed, the caller provides a
function for yielding.
§Crate feature flags
-
sync
(default): ImplementsYieldProgress: Send + Sync
for use with multi-threaded executors.Requires
std
to be available for the compilation target. -
log_hiccups
: Log intervals between yields longer than 100 ms, via thelog
library.Requires
std
to be available for the compilation target. This might be removed in favor of something more configurable in future versions, in which case the feature flag may still exist but do nothing.
Structs§
- Builder for creating root
YieldProgress
instances. - Information available to a progress callback.
- Information available to a yield callback.
- Allows a long-running async task to report its progress, while also yielding to the scheduler (e.g. for single-threaded web environment) and introducing cancellation points.
Functions§
- The minimum, executor-agnostic yield operation. This may be unsuitable for some applications.