pub struct Control { /* private fields */ }Expand description
Cooperative lifecycle handle shared across an invocation.
Cloning a Control shares the same cancellation and limit state. Cancellation
is cooperative: RuntimeInvocation::emit checks Control::is_cancelled
before invoking the closure and before calling AgentRuntime::run; the
underlying runtime does not yet support hard cancellation. Timeout and
concurrency limit are enforced by event listeners spawned through
RuntimeInvocation::on.
§Type-erased data
Control also carries an extension map for injecting arbitrary typed data
into handlers (similar to actix-web::web::Data<T>). Use Control::set_data
and Control::data to store and retrieve Arc<T> values keyed by TypeId.
Implementations§
Source§impl Control
impl Control
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns true once cancel has been called on any clone.
Sourcepub fn set_timeout(&self, timeout: Duration)
pub fn set_timeout(&self, timeout: Duration)
Sets a provider/runtime call timeout hint.
Sourcepub fn set_concurrency_limit(&self, limit: usize)
pub fn set_concurrency_limit(&self, limit: usize)
Sets a concurrency limit hint.
Sourcepub fn concurrency_limit(&self) -> Option<usize>
pub fn concurrency_limit(&self) -> Option<usize>
Returns the configured concurrency limit hint, if any.