behavior/transition/
actions.rs1use super::sending::SendAlgebra;
4use crate::Exit;
5use crate::actor::{Address, BirthMode, Create};
6use crate::verdict::{Never, Step};
7
8pub type Become<A, Ph = Never> = Step<Ph, Exit<A>>;
9
10pub struct Actions<A: Address, Ph, Sends, Birth: BirthMode> {
19 pub sends: Sends,
20 pub creates: Vec<Create<A, Birth::Child>>,
21 pub become_: Become<A, Ph>,
22}
23
24impl<A: Address, Ph, Sends: SendAlgebra, Birth: BirthMode> Actions<A, Ph, Sends, Birth> {
25 #[must_use]
26 pub fn just(become_: Become<A, Ph>) -> Self {
27 Self {
28 sends: Sends::empty(),
29 creates: Vec::new(),
30 become_,
31 }
32 }
33
34 #[must_use]
35 pub fn cont() -> Self {
36 Self::just(Step::Continue)
37 }
38 #[must_use]
39 pub fn stop(exit: Exit<A>) -> Self {
40 Self::just(Step::Stop(exit))
41 }
42 #[must_use]
43 pub fn goto(phase: Ph) -> Self {
44 Self::just(Step::Goto(phase))
45 }
46}
47
48pub type Acted<A, Ph, Sends, Birth, E> = Result<Actions<A, Ph, Sends, Birth>, E>;