pub struct SubScenario {
pub id: String,
pub name: String,
pub state_machine: StateMachine,
pub input_mapping: HashMap<String, String>,
pub output_mapping: HashMap<String, String>,
pub description: Option<String>,
}Expand description
Sub-scenario definition for nested state machine execution
A sub-scenario is a nested state machine that can be referenced from a parent state machine. It supports input/output mapping to pass data between parent and child state machines.
Fields§
§id: StringUnique identifier for this sub-scenario
name: StringHuman-readable name
state_machine: StateMachineNested state machine definition
input_mapping: HashMap<String, String>Input mapping: maps parent state variables to sub-scenario input variables
Example: {"parent.status" => "sub.input.status"}
output_mapping: HashMap<String, String>Output mapping: maps sub-scenario output variables to parent state variables
Example: {"sub.output.result" => "parent.result"}
description: Option<String>Optional description
Implementations§
Source§impl SubScenario
impl SubScenario
Sourcepub fn new(
id: impl Into<String>,
name: impl Into<String>,
state_machine: StateMachine,
) -> SubScenario
pub fn new( id: impl Into<String>, name: impl Into<String>, state_machine: StateMachine, ) -> SubScenario
Create a new sub-scenario
Sourcepub fn with_description(self, description: impl Into<String>) -> SubScenario
pub fn with_description(self, description: impl Into<String>) -> SubScenario
Set description
Sourcepub fn with_input_mapping(
self,
parent_var: impl Into<String>,
sub_var: impl Into<String>,
) -> SubScenario
pub fn with_input_mapping( self, parent_var: impl Into<String>, sub_var: impl Into<String>, ) -> SubScenario
Add an input mapping
Maps a parent state variable to a sub-scenario input variable.
Sourcepub fn with_output_mapping(
self,
sub_var: impl Into<String>,
parent_var: impl Into<String>,
) -> SubScenario
pub fn with_output_mapping( self, sub_var: impl Into<String>, parent_var: impl Into<String>, ) -> SubScenario
Add an output mapping
Maps a sub-scenario output variable to a parent state variable.
Sourcepub fn state_machine(&self) -> &StateMachine
pub fn state_machine(&self) -> &StateMachine
Get the nested state machine
Sourcepub fn state_machine_mut(&mut self) -> &mut StateMachine
pub fn state_machine_mut(&mut self) -> &mut StateMachine
Get the nested state machine mutably
Trait Implementations§
Source§impl Clone for SubScenario
impl Clone for SubScenario
Source§fn clone(&self) -> SubScenario
fn clone(&self) -> SubScenario
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more