pub struct Transition {
pub from: String,
pub event: String,
pub to: String,
pub guard: Option<String>,
pub actions: Vec<String>,
pub description: Option<String>,
}Expand description
A transition between two states, triggered by an event.
Guards gate the transition; actions fire when the transition is taken. Both are string references resolved externally.
Fields§
§from: StringSource state name.
event: StringEvent name that triggers this transition.
to: StringTarget state name.
guard: Option<String>Guard condition (string reference, resolved at runtime).
actions: Vec<String>Side effects executed when transition fires (string references).
description: Option<String>Description of what this transition represents.
Implementations§
Source§impl Transition
impl Transition
Sourcepub fn new(
from: impl Into<String>,
event: impl Into<String>,
to: impl Into<String>,
) -> Self
pub fn new( from: impl Into<String>, event: impl Into<String>, to: impl Into<String>, ) -> Self
Creates a new transition from source state to target state on event.
Sourcepub fn guard(self, guard: impl Into<String>) -> Self
pub fn guard(self, guard: impl Into<String>) -> Self
Sets the guard condition (string reference).
Sourcepub fn actions(self, actions: Vec<impl Into<String>>) -> Self
pub fn actions(self, actions: Vec<impl Into<String>>) -> Self
Sets the transition actions (string references).
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Sets the description.
Trait Implementations§
Source§impl Clone for Transition
impl Clone for Transition
Source§fn clone(&self) -> Transition
fn clone(&self) -> Transition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transition
impl Debug for Transition
Source§impl<'de> Deserialize<'de> for Transition
impl<'de> Deserialize<'de> for Transition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for Transition
impl JsonSchema for Transition
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for Transition
impl PartialEq for Transition
Source§impl Serialize for Transition
impl Serialize for Transition
impl StructuralPartialEq for Transition
Auto Trait Implementations§
impl Freeze for Transition
impl RefUnwindSafe for Transition
impl Send for Transition
impl Sync for Transition
impl Unpin for Transition
impl UnsafeUnpin for Transition
impl UnwindSafe for Transition
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