pub struct InterruptableRunner { /* private fields */ }Expand description
Interruptable execution handler
Implementations§
Source§impl InterruptableRunner
impl InterruptableRunner
pub fn new() -> Self
Sourcepub fn with_approval_policy<P: ApprovalPolicy + 'static>(
self,
policy: P,
) -> Self
pub fn with_approval_policy<P: ApprovalPolicy + 'static>( self, policy: P, ) -> Self
Set the approval policy for this runner
Sourcepub fn with_approval_policy_arc(self, policy: Arc<dyn ApprovalPolicy>) -> Self
pub fn with_approval_policy_arc(self, policy: Arc<dyn ApprovalPolicy>) -> Self
Set the approval policy from an Arc
Sourcepub fn check_plan_approval(&self, plan: &Value) -> Option<String>
pub fn check_plan_approval(&self, plan: &Value) -> Option<String>
Check if a plan requires approval based on the configured policy Returns the approval reason if approval is required, None otherwise
Sourcepub fn requires_approval(&self, plan: &Value) -> bool
pub fn requires_approval(&self, plan: &Value) -> bool
Check if a plan requires approval (boolean)
Sourcepub fn policy_name(&self) -> Option<&str>
pub fn policy_name(&self) -> Option<&str>
Get the approval policy name (for logging)
Sourcepub fn execution_id(&self) -> &ExecutionId
pub fn execution_id(&self) -> &ExecutionId
Get the execution ID
pub fn emitter(&self) -> &EventEmitter
Sourcepub fn decision_sender(&self) -> Sender<InterruptDecision>
pub fn decision_sender(&self) -> Sender<InterruptDecision>
Get the decision sender (for external use to send decisions)
Sourcepub async fn request_approval_if_needed(&mut self, plan: &Value) -> Result<bool>
pub async fn request_approval_if_needed(&mut self, plan: &Value) -> Result<bool>
Request approval if the policy requires it
This combines policy check and approval request into a single method. Returns Ok(true) if:
- No approval policy is set
- Policy doesn’t require approval for this plan
- Approval is requested and granted
Returns Ok(false) if approval is rejected. Returns Err if there’s a communication error.
Sourcepub async fn request_approval(&mut self, plan: Value) -> Result<bool>
pub async fn request_approval(&mut self, plan: Value) -> Result<bool>
Request approval and wait for decision
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InterruptableRunner
impl !RefUnwindSafe for InterruptableRunner
impl Send for InterruptableRunner
impl Sync for InterruptableRunner
impl Unpin for InterruptableRunner
impl UnsafeUnpin for InterruptableRunner
impl !UnwindSafe for InterruptableRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more