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 method
    fn transition(
        &mut self,
        _turn: ActiveTurn,
        event: Self::Event,
    ) -> BehaviorActed<Self>;

    // Provided method
    fn init(&mut self, _turn: InitializationTurn) -> BehaviorActed<Self>
       where Self: Sized { ... }
}
Expand description

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

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 transition( &mut self, _turn: ActiveTurn, event: Self::Event, ) -> BehaviorActed<Self>

Fold exactly one event into explicit actions and the next behavior.

§Errors

Returns the behavior’s declared controlled transition failure.

Provided Methods§

Source

fn init(&mut self, _turn: InitializationTurn) -> BehaviorActed<Self>
where Self: Sized,

Produce initialization actions before the first event is accepted.

§Errors

Returns the behavior’s declared controlled initialization failure.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<A, D, J, R, C> Behavior for WorkerPool<A, D, J, R, C>
where A: Address, A::Nonce: From<u64>, D: Behavior<Addr = A, Msg = PoolResponse<J, R, A>>, J: Clone, C: Behavior<Addr = A, Msg = PoolAssignment<J>, Ph = Never>,

Source§

impl<A, D, K, J, R, C, S> Behavior for KeyedWorkerPool<A, D, K, J, R, C, S>
where A: Address, A::Nonce: From<u64>, D: Behavior<Addr = A, Msg = PoolResponse<J, R, A>>, K: Eq, J: Clone, C: Behavior<Addr = A, Msg = PoolAssignment<J>, Ph = Never>, S: AffinitySelector<K, A::Nonce>,

Source§

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

Source§

impl<B, A, Ph, Sends, Br> Behavior for Deadline<B>
where A: Address, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br>, B::Event: RouteInput<TimerElapsed>,

Source§

type Addr = A

Source§

type Msg = <B as Behavior>::Msg

Source§

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

Source§

type Sends = DeadlineSends<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 FinalizeOnShutdown<B>
where A: Address, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br>,

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 ReceiveTimeout<B>
where A: Address, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br>, B::Event: RouteInput<TimerElapsed>,

Source§

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

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 Watch<B>
where A: Address, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Br>, B::Event: RouteInput<PeerStopped<A>>,

Source§

type Addr = A

Source§

type Msg = <B as Behavior>::Msg

Source§

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

Source§

type Sends = WatchSends<A, Sends>

Source§

type Ph = Ph

Source§

type Error = <B as Behavior>::Error

Source§

type Birth = Br

Source§

impl<B, A, Sends, Br> Behavior for Stash<B>
where A: Address, Sends: SendAlgebra, Br: BirthMode, B: Behavior<Addr = A, Ph = Never, Sends = Sends, Birth = Br>,

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 Supervisor<B, C>
where A: Address, Sends: SendAlgebra, B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>>, B::Event: RouteInput<ChildStopped<A>> + RouteInput<CreationResolved<A::Nonce>> + RouteInput<WorkerCreationResolved<A::Nonce>>, A::Nonce: From<u64>, C: Behavior<Ph = Never, Addr = B::Addr>,

Source§

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