use super::sending::SendAlgebra;
use crate::Exit;
use crate::actor::{Address, BirthMode, Create};
use crate::verdict::{Never, Step};
pub type Become<A, Ph = Never> = Step<Ph, Exit<A>>;
pub struct Actions<A: Address, Ph, Sends, Birth: BirthMode> {
pub sends: Sends,
pub creates: Vec<Create<A, Birth::Child>>,
pub become_: Become<A, Ph>,
}
impl<A: Address, Ph, Sends: SendAlgebra, Birth: BirthMode> Actions<A, Ph, Sends, Birth> {
#[must_use]
pub fn just(become_: Become<A, Ph>) -> Self {
Self {
sends: Sends::empty(),
creates: Vec::new(),
become_,
}
}
#[must_use]
pub fn cont() -> Self {
Self::just(Step::Continue)
}
#[must_use]
pub fn stop(exit: Exit<A>) -> Self {
Self::just(Step::Stop(exit))
}
#[must_use]
pub fn goto(phase: Ph) -> Self {
Self::just(Step::Goto(phase))
}
}
pub type Acted<A, Ph, Sends, Birth, E> = Result<Actions<A, Ph, Sends, Birth>, E>;