pub struct InterruptContext { /* private fields */ }Expand description
Interrupt context for managing human-in-the-flow interactions
The context tracks interrupt state across node executions, enabling resumption with human-provided values.
§Examples
ⓘ
use juncture_core::interrupt::InterruptContext;
use serde_json::json;
let mut context = InterruptContext::new(
vec![Some(json!("human_input"))],
tokio::sync::mpsc::unbounded_channel(),
);
// Get next interrupt index (increments counter)
let index = context.next_index();Implementations§
Source§impl InterruptContext
impl InterruptContext
Sourcepub fn new(
resume_values: Vec<Option<Value>>,
interrupt_tx: UnboundedSender<InterruptSignal>,
) -> Self
pub fn new( resume_values: Vec<Option<Value>>, interrupt_tx: UnboundedSender<InterruptSignal>, ) -> Self
Create a new interrupt context
§Arguments
resume_values- Values to resume interrupts with (indexed by position)interrupt_tx- Channel for sending interrupt signals
Sourcepub fn next_index(&self) -> usize
pub fn next_index(&self) -> usize
Get the next interrupt index (atomically increments counter)
Sourcepub fn get_resume_value(&self, index: usize) -> Option<Value>
pub fn get_resume_value(&self, index: usize) -> Option<Value>
Get resume value for a given index
Returns None if no resume value exists for this index.
Sourcepub fn current_index(&self) -> usize
pub fn current_index(&self) -> usize
Get the current index without incrementing
Sourcepub fn send_interrupt(
&self,
signal: InterruptSignal,
) -> Result<(), SendError<InterruptSignal>>
pub fn send_interrupt( &self, signal: InterruptSignal, ) -> Result<(), SendError<InterruptSignal>>
Trait Implementations§
Source§impl Clone for InterruptContext
impl Clone for InterruptContext
Source§fn clone(&self) -> InterruptContext
fn clone(&self) -> InterruptContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InterruptContext
impl RefUnwindSafe for InterruptContext
impl Send for InterruptContext
impl Sync for InterruptContext
impl Unpin for InterruptContext
impl UnsafeUnpin for InterruptContext
impl UnwindSafe for InterruptContext
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