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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SubScenario
impl Debug for SubScenario
Source§impl<'de> Deserialize<'de> for SubScenario
impl<'de> Deserialize<'de> for SubScenario
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SubScenario, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SubScenario, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SubScenario
impl JsonSchema for SubScenario
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Serialize for SubScenario
impl Serialize for SubScenario
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for SubScenario
impl RefUnwindSafe for SubScenario
impl Send for SubScenario
impl Sync for SubScenario
impl Unpin for SubScenario
impl UnsafeUnpin for SubScenario
impl UnwindSafe for SubScenario
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more