📝 clarify async runtime constructor inputs

This commit is contained in:
Nanaloveyuki
2026-06-14 10:14:31 +08:00
parent 20e08efb78
commit 1073559f6a
+3
View File
@@ -41,6 +41,7 @@ Detailed rules explaining key parameters and behaviors
- It does not query the current backend automatically.
- `async_runtime_state()` is the higher-level API that reads these values from the live runtime environment.
- It also does not validate whether the supplied pair matches the current backend contract.
- The supplied `mode` and `background_worker` values are stored exactly as provided; this constructor does not recompute, normalize, or cross-check either field.
- The constructed value matches the same public shape used by async runtime serializers.
- Because `AsyncRuntimeState` is only a data snapshot type, this constructor is mainly useful for tests, adapters, and synthetic diagnostics rather than ordinary runtime probing.
@@ -77,6 +78,8 @@ e.g.:
- If callers manually pair `NativeWorker` with `false` or `Compatibility` with `true`, the constructor still accepts that snapshot because it does not enforce backend consistency.
- If callers want the currently probed runtime pair instead of a synthetic one, they must pass `async_runtime_mode()` plus `async_runtime_supports_background_worker()` explicitly or use `async_runtime_state()`.
### Notes
1. Use this helper when code should construct an `AsyncRuntimeState` value explicitly.