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): AddsYieldProgress::split_evenly_concurrent().Requires
stdto be available for the compilation target. -
log_hiccups: Log intervals between yields longer than 100 ms, via theloglibrary.Requires
stdto 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
- Builder for creating root
YieldProgressinstances. - Progress
Info - Information available to a progress callback.
- Yield
Info - Information available to a yield callback.
- Yield
Progress - 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§
- basic_
yield_ now - The minimum, executor-agnostic yield operation. This may be unsuitable for some applications.