Async-runtime-supports-background-worker
Return a boolean telling callers whether the current backend provides native background worker semantics for bitlogger_async. This is the narrowest capability probe when only worker support matters.
Interface
pub fn async_runtime_supports_background_worker() -> Bool {}input
none- No explicit arguments are required.
output
Bool-truewhen native background worker semantics are available, otherwisefalse.
Explanation
Detailed rules explaining key parameters and behaviors
trueindicates native worker capability.falseindicates compatibility-mode behavior.- This helper is derived from backend-specific async runtime implementation choice.
- The boolean is read from the active backend helper on each call rather than from a cached runtime snapshot object.
- In the current backend split, the native implementation returns
truewhile the compatibility stub returnsfalse, matching the same mode pair exposed throughasync_runtime_mode()andasync_runtime_state(). - The async library still targets multiple backends even when this helper returns
false. - Use it when an enum branch is unnecessary and a boolean capability check is enough.
How to Use
Here are some specific examples provided.
When Need A Simple Capability Branch
When logic only depends on worker availability:
if async_runtime_supports_background_worker() {
println("native worker available")
}In this example, callers avoid a more verbose mode match.
When Add Diagnostics Labels
When capability should be surfaced in diagnostics:
println(if async_runtime_supports_background_worker() { "worker" } else { "compat" })In this example, a simple boolean can drive compact status output.
Error Case
e.g.:
This API does not normally fail at runtime; it reflects compiled backend behavior.
If callers need the current paired mode and worker flag together, prefer a fresh
async_runtime_state()call instead of mixing this boolean with an older saved mode value.If you need the exact mode name rather than a boolean, use
async_runtime_mode()orasync_runtime_state().
Notes
Use this helper for minimal capability checks.
Prefer
async_runtime_state()when you want the same information in a richer object.A
falseresult should be read as "compatibility-mode runtime behavior" rather than "async library unsupported on this target".This helper does not by itself imply that every non-worker backend has been equally re-verified for the current release; see target-verification.md.