#[non_exhaustive]pub struct ChildWorkflowContext {
pub run_ctx: Arc<dyn RunContext>,
pub extra_plugin_dirs: Vec<String>,
pub workflow_run_id: String,
pub model: Option<String>,
pub exec_config: WorkflowExecConfig,
pub inputs: HashMap<String, String>,
pub event_sinks: Arc<[Arc<dyn EventSink>]>,
}Expand description
Subset of ExecutionState exposed to ChildWorkflowRunner implementations.
The full ExecutionState carries the engine’s mutable runtime — registries,
accumulators, schema resolver, position pointer, cancellation token —
none of which a harness needs to spawn a child workflow run. Passing it
across the trait boundary makes every ExecutionState field rename or
restructuring a breaking change for every ChildWorkflowRunner implementor.
ChildWorkflowContext is the narrow, stable surface: every field listed
here is something the bridge actually reads when constructing the child
run. Build via ExecutionState::child_workflow_context.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.run_ctx: Arc<dyn RunContext>§extra_plugin_dirs: Vec<String>§workflow_run_id: String§model: Option<String>§exec_config: WorkflowExecConfig§inputs: HashMap<String, String>§event_sinks: Arc<[Arc<dyn EventSink>]>Implementations§
Source§impl ChildWorkflowContext
impl ChildWorkflowContext
Sourcepub fn new(
run_ctx: Arc<dyn RunContext>,
extra_plugin_dirs: Vec<String>,
workflow_run_id: String,
model: Option<String>,
exec_config: WorkflowExecConfig,
inputs: HashMap<String, String>,
event_sinks: Arc<[Arc<dyn EventSink>]>,
) -> Self
pub fn new( run_ctx: Arc<dyn RunContext>, extra_plugin_dirs: Vec<String>, workflow_run_id: String, model: Option<String>, exec_config: WorkflowExecConfig, inputs: HashMap<String, String>, event_sinks: Arc<[Arc<dyn EventSink>]>, ) -> Self
Examples found in repository?
examples/logging_child_runner.rs (lines 93-101)
90fn main() {
91 let runner = LoggingChildRunner;
92 let ctx = Arc::new(StubCtx(std::env::temp_dir()));
93 let parent_ctx = ChildWorkflowContext::new(
94 Arc::clone(&ctx) as Arc<dyn RunContext>,
95 vec![],
96 "parent-run-001".into(),
97 None,
98 WorkflowExecConfig::default(),
99 HashMap::new(),
100 Arc::from(vec![]),
101 );
102 let params = ChildWorkflowInput {
103 inputs: HashMap::new(),
104 iteration: 0,
105 as_identity: None,
106 depth: 1,
107 parent_step_id: None,
108 cancellation: CancellationToken::new(),
109 };
110 let result = runner
111 .execute_child("child-workflow", &parent_ctx, params)
112 .expect("execute_child failed");
113 println!("succeeded: {}", result.all_succeeded);
114}Trait Implementations§
Source§impl Clone for ChildWorkflowContext
impl Clone for ChildWorkflowContext
Source§fn clone(&self) -> ChildWorkflowContext
fn clone(&self) -> ChildWorkflowContext
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 ChildWorkflowContext
impl !RefUnwindSafe for ChildWorkflowContext
impl Send for ChildWorkflowContext
impl Sync for ChildWorkflowContext
impl Unpin for ChildWorkflowContext
impl UnsafeUnpin for ChildWorkflowContext
impl !UnwindSafe for ChildWorkflowContext
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