Skip to main content

get_invocation_context

Function get_invocation_context 

Source
pub fn get_invocation_context() -> Option<InvocationContext>
Expand description

Get the current invocation context, if running inside a task.

Resolution order:

  1. tokio INVOCATION_CTX task_local (async task execution path)
  2. std::thread_local fallback (spawn_blocking / rayon path)

Returns None when called outside a runner-managed task execution (e.g. from a test or from top-level application code).