pub struct Transition<State, Effect> { /* private fields */ }Expand description
English:
Owned next state and ordered effect descriptions returned by a ProcessManager.
Construction and access do not execute effects or persist the state. Empty effects are valid;
callers choose how to coordinate state storage and effect execution.
Inspect the transition before taking ownership of both components.
日本語:
ProcessManager が返す、所有された次状態と順序付きの副作用の記述です。
構築や参照で副作用を実行したり状態を永続化したりしません。空の副作用列も許容し、
状態保存と副作用実行の連携方法は呼び出し側が決めます。
遷移を参照してから、両方の構成要素の所有権を取り出します。
§Example / 使用例
use ddd_toolkit_core::Transition;
let transition = Transition::new("paid", vec!["send receipt"]);
assert_eq!(transition.state(), &"paid");
assert_eq!(transition.effects(), &["send receipt"]);
let (state, effects) = transition.into_parts();
assert_eq!((state, effects), ("paid", vec!["send receipt"]));Implementations§
Source§impl<State, Effect> Transition<State, Effect>
impl<State, Effect> Transition<State, Effect>
Sourcepub fn new(state: State, effects: Vec<Effect>) -> Transition<State, Effect>
pub fn new(state: State, effects: Vec<Effect>) -> Transition<State, Effect>
English:
Stores state and effects unchanged, preserving the vector’s order without validation.
日本語:
検証せず、ベクターの順序を保ったまま state と effects を保持します。
Sourcepub fn state(&self) -> &State
pub fn state(&self) -> &State
English:
Borrows the next state without applying it to any external store.
日本語:
外部ストアへの反映を行わず、次状態を借用します。
Sourcepub fn effects(&self) -> &[Effect]
pub fn effects(&self) -> &[Effect]
English:
Borrows the effect descriptions in their stored order without executing them.
日本語:
実行せず、保持している順序で副作用の記述を借用します。
Sourcepub fn into_parts(self) -> (State, Vec<Effect>)
pub fn into_parts(self) -> (State, Vec<Effect>)
English:
Consumes the transition to return its state and effect vector without cloning.
日本語:
遷移を消費し、複製せずに状態と副作用のベクターを返します。