Async-runtime-state-type
AsyncRuntimeState is the public snapshot type used to describe backend-level async runtime capability. It is a direct alias to the async runtime state model returned by async_runtime_state() and used by async diagnostics serializers.
Interface
pub type AsyncRuntimeState = @utils.AsyncRuntimeStateoutput
AsyncRuntimeState- Public runtime snapshot containingmodeandbackground_worker.
Explanation
Detailed rules explaining key parameters and behaviors
- This is a type alias, not a live runtime controller.
- The current fields are
mode : AsyncRuntimeModeandbackground_worker : Bool. async_runtime_state()returns this type directly as an environment-level snapshot.async_runtime_state()currently builds that snapshot fromasync_runtime_mode()andasync_runtime_supports_background_worker().async_runtime_state_to_json(...)andstringify_async_runtime_state(...)serialize the same snapshot shape for diagnostics.AsyncRuntimeState::new(...)can also construct this type manually, but manual construction is synthetic data and does not probe the current backend by itself.- The type itself does not distinguish live backend snapshots from hand-built ones; callers must track whether a given
AsyncRuntimeStatevalue came fromasync_runtime_state()or from manual construction.
How to Use
Here are some specific examples provided.
When Need A Typed Backend Capability Snapshot
When startup or diagnostics code should keep the runtime state as structured data:
let runtime : AsyncRuntimeState = async_runtime_state()In this example, the backend capability snapshot stays available as a typed value instead of only as printed text.
When Need To Read Runtime Mode And Worker Support Together
When code should inspect both async mode and worker availability from one object:
let runtime = async_runtime_state()
if runtime.background_worker {
println(async_runtime_mode_label(runtime.mode))
}In this example, both fields are consumed from the same public snapshot type.
Error Case
e.g.:
AsyncRuntimeStateitself does not have a runtime failure mode.The snapshot is point-in-time diagnostic data; it should not be treated as proof that every target was re-verified in the current release cycle.
Because this is just a data shape, manual construction can represent combinations that do not come from the current backend probe.
Receiving an
AsyncRuntimeStatevalue alone does not prove it came from the current backend rather than from a synthetic constructor path.
Notes
Use
async_runtime_state()when you need a value of this type from the current backend.Use
AsyncLoggerStatewhen logger-instance queue and lifecycle information is also required.Use
async_runtime_mode_label(...)when themodefield should be rendered as stable text such asnative_workerorcompatibility.