Skip to main content

Behavior

Trait Behavior 

Source
pub trait Behavior {
    type Addr: Address;
    type Msg;
    type Event: UserEvent<Addr = Self::Addr, Message = Self::Msg>;
    type Sends: SendAlgebra;
    type Ph;
    type Error;
    type Birth: BirthMode;

    // Required methods
    fn init(&mut self) -> impl Future<Output = BehaviorActed<Self>> + Send;
    fn step(
        &mut self,
        event: Self::Event,
    ) -> impl Future<Output = BehaviorActed<Self>> + Send;
}
Expand description

A composed pure behavior. Event is the complete accepted protocol; every successful transition returns the declared Actions algebra.

Effect and termination escape seats are intentionally absent:

use behavior::Behavior;

fn erased_effect<B: Behavior>() -> core::marker::PhantomData<B::Effect> {
    core::marker::PhantomData
}

Required Associated Types§

Source

type Addr: Address

Source

type Msg

Source

type Event: UserEvent<Addr = Self::Addr, Message = Self::Msg>

Source

type Sends: SendAlgebra

Source

type Ph

Source

type Error

Source

type Birth: BirthMode

Required Methods§

Source

fn init(&mut self) -> impl Future<Output = BehaviorActed<Self>> + Send

Source

fn step( &mut self, event: Self::Event, ) -> impl Future<Output = BehaviorActed<Self>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A, S, M, P, E> Behavior for Fsm<A, S, M, P, E>
where A: Address + Send, A::Nonce: Send, S: Send, M: Send, P: Copy + PartialEq + Send, E: Send,

Source§

impl<B, A, Ph, Sends, Br> Behavior for At<B>
where A: Address + Send, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br> + Send, B::Event: TimeEvent + Send, B::Msg: Send,

Source§

impl<B, A, Ph, Sends, Br> Behavior for FinalizeOnShutdown<B>
where A: Address + Send, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br> + Send, B::Event: Send, B::Msg: Send,

Source§

type Addr = A

Source§

type Msg = <B as Behavior>::Msg

Source§

type Event = ShutdownProtocol<<B as Behavior>::Event>

Source§

type Sends = Sends

Source§

type Ph = Ph

Source§

type Error = <B as Behavior>::Error

Source§

type Birth = Br

Source§

impl<B, A, Ph, Sends, Br> Behavior for Spec<B>
where A: Address + Send, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br> + Send, A::Nonce: Send, B::Msg: Send, B::Event: Send,

Source§

type Addr = A

Source§

type Msg = <B as Behavior>::Msg

Source§

type Event = <B as Behavior>::Event

Source§

type Sends = Sends

Source§

type Ph = Ph

Source§

type Error = <B as Behavior>::Error

Source§

type Birth = Br

Source§

impl<B, A, Ph, Sends, Br> Behavior for StopOnShutdown<B>
where A: Address + Send, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br> + Send, B::Event: Send, B::Msg: Send,

Source§

type Addr = A

Source§

type Msg = <B as Behavior>::Msg

Source§

type Event = ShutdownProtocol<<B as Behavior>::Event>

Source§

type Sends = Sends

Source§

type Ph = Ph

Source§

type Error = <B as Behavior>::Error

Source§

type Birth = Br

Source§

impl<B, A, Ph, Sends, Br> Behavior for Watching<B>
where A: Address + Send, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br> + Send, B::Event: PeerEvent<B::Addr> + Send, B::Msg: Send,

Source§

impl<B, A, Sends, Br> Behavior for Stashing<B>
where A: Address + Send, Sends: SendAlgebra + Send, Br: BirthMode, B: Behavior<Addr = A, Ph = Never, Sends = Sends, Birth = Br> + Send, A::Nonce: Send, B::Msg: Send, B::Event: Send, Br::Child: Send,

Source§

type Addr = A

Source§

type Msg = <B as Behavior>::Msg

Source§

type Event = <B as Behavior>::Event

Source§

type Sends = Sends

Source§

type Ph = Never

Source§

type Error = <B as Behavior>::Error

Source§

type Birth = Br

Source§

impl<B, C, A, Ph, Sends> Behavior for Supervising<B, C>
where A: Address + Send, Sends: SendAlgebra, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>> + Send, B::Event: ChildEvent<B::Addr> + Send, A::Nonce: From<u64> + Send, B::Msg: Send, C: Behavior<Ph = Never, Addr = B::Addr> + Send,

Source§

impl<C> Behavior for Proxy<C>
where C: Behavior<Ph = Never> + Send, C::Addr: Send, <C::Addr as Address>::Nonce: From<u64> + Send, C::Msg: Send,

Source§

impl<S, O, Br, E> Behavior for Base<S, O, Br, E>
where S: State<O, Br, E> + Send, S::Addr: Send, S::Msg: Send, Br: BirthMode, Br::Child: Send, E: Send,

Source§

type Addr = <S as State<O, Br, E>>::Addr

Source§

type Msg = <S as State<O, Br, E>>::Msg

Source§

type Event = User<<S as State<O, Br, E>>::Addr, <S as State<O, Br, E>>::Msg>

Source§

type Sends = Vec<Delivery<<S as State<O, Br, E>>::Addr, O>>

Source§

type Ph = Never

Source§

type Error = E

Source§

type Birth = Br