Skip to main content

Transition

Struct Transition 

Source
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>

Source

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 を保持します。

Source

pub fn state(&self) -> &State

English:
Borrows the next state without applying it to any external store.

日本語:
外部ストアへの反映を行わず、次状態を借用します。

Source

pub fn effects(&self) -> &[Effect]

English:
Borrows the effect descriptions in their stored order without executing them.

日本語:
実行せず、保持している順序で副作用の記述を借用します。

Source

pub fn into_parts(self) -> (State, Vec<Effect>)

English:
Consumes the transition to return its state and effect vector without cloning.

日本語:
遷移を消費し、複製せずに状態と副作用のベクターを返します。

Auto Trait Implementations§

§

impl<State, Effect> Freeze for Transition<State, Effect>
where State: Freeze, Vec<Effect>: Freeze,

§

impl<State, Effect> RefUnwindSafe for Transition<State, Effect>
where State: RefUnwindSafe, Vec<Effect>: RefUnwindSafe,

§

impl<State, Effect> Send for Transition<State, Effect>
where State: Send, Vec<Effect>: Send,

§

impl<State, Effect> Sync for Transition<State, Effect>
where State: Sync, Vec<Effect>: Sync,

§

impl<State, Effect> Unpin for Transition<State, Effect>
where State: Unpin, Vec<Effect>: Unpin,

§

impl<State, Effect> UnsafeUnpin for Transition<State, Effect>
where State: UnsafeUnpin, Vec<Effect>: UnsafeUnpin,

§

impl<State, Effect> UnwindSafe for Transition<State, Effect>
where State: UnwindSafe, Vec<Effect>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.