Skip to main content

Compose

Struct Compose 

Source
pub struct Compose<B> { /* private fields */ }

Implementations§

Source§

impl<S, Sends, Br, E> Compose<Pure<S, Sends, Br, E>>
where S: Handler<Sends, Br, E>, Sends: SendAlgebra, Br: BirthMode,

Source

pub fn new(state: S) -> Self

Source§

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

Source

pub fn machine( state: S, phase: P, on: fn(P, &mut S, &M) -> Result<Move<P>, E>, ) -> Self

Source§

impl<S, A, M, Sends, Br, E, I, F> Compose<BehaviorFn<S, A, M, Sends, Br, E, I, F>>
where A: Address, Sends: SendAlgebra, Br: BirthMode, I: FnMut(&mut S) -> Acted<A, Never, Sends, Br, E>, F: FnMut(&mut S, A, M) -> Acted<A, Never, Sends, Br, E>,

Source

pub fn from_fns(state: S, initialize: I, transition: F) -> Self

Define a concrete behavior from explicit initialization and user-event folds, ready for typed wrapper composition.

Source§

impl<B: Behavior> Compose<B>

Source

pub fn from_behavior(behavior: B) -> Self

Source

pub fn build(self) -> B

Source

pub fn behavior(&self) -> &B

Source

pub fn stop_on_shutdown(self) -> Compose<StopOnShutdown<B>>

Stop normally when a typed shutdown request is folded.

Source

pub fn finalize_on_shutdown( self, finalize: ShutdownReaction<B>, ) -> Compose<FinalizeOnShutdown<B>>

Apply one final pure fold, retain its sends and creations, and stop normally regardless of the fold’s become verdict.

Source

pub fn watch( self, peer: B::Addr, on_stopped: LinkReaction<B>, ) -> Compose<Watch<B>>

Observe a peer and apply a pure reaction when it stops.

Source

pub fn deadline( self, when: Option<Instant>, on_reached: DeadlineReaction<B>, ) -> Compose<Deadline<B>>

Apply a pure reaction when the given absolute time is reached.

§Panics

Panics if one specification composes more than u64::MAX timer capabilities.

Source

pub fn receive_timeout( self, after: Duration, on_elapsed: ReceiveTimeoutReaction<B>, ) -> Compose<ReceiveTimeout<B>>

Notify the behavior once after an idle period containing no successful user communication.

Initialization and each successful continuing user fold emit a relative schedule. Service events never reset inactivity. A matching delivery is consumed before on_elapsed runs, and a continuing reaction remains unarmed until another successful continuing user communication.

§Panics

Panics if one specification composes more than u64::MAX timer capabilities.

Source

pub fn stash(self, route: fn(&B::Msg) -> StashRoute) -> Compose<Stash<B>>
where B: Behavior<Ph = Never>,

Hold messages selected by route and replay them on Release.

Source

pub fn children<C>( self, fleet: (usize, fn(usize) -> C), ) -> Compose<Supervisor<B, C>>
where B: Behavior<Birth = Births<C>>, C: Behavior<Ph = Never, Addr = B::Addr>, <B::Addr as Address>::Nonce: From<u64>,

Create a supervised child topology. Concrete proxy and monitor types remain hidden in the returned typestate.

Source

pub fn children_with_nonces<C>( self, nonces: fn(usize) -> <B::Addr as Address>::Nonce, count: usize, build: fn(usize) -> C, ) -> Compose<Supervisor<B, C>>
where B: Behavior<Birth = Births<C>>, C: Behavior<Ph = Never, Addr = B::Addr>, <B::Addr as Address>::Nonce: From<u64>,

Source§

impl<B, C> Compose<Supervisor<B, C>>
where B: Behavior<Birth = Births<C>>, C: Behavior<Ph = Never, Addr = B::Addr>, <B::Addr as Address>::Nonce: From<u64>,

Source

pub fn restart(self, strategy: Strategy) -> Self

Source

pub fn when(self, policy: RestartPolicy) -> Self

Source

pub fn within(self, maximum: u32, window: Duration) -> Self

Source

pub fn on_supervision_failure( self, reaction: SupervisionFailureReaction<B>, ) -> Self

Apply a pure reaction when supervision can no longer preserve its child topology.

Trait Implementations§

Source§

impl<B, A, Ph, Sends, Br> Behavior for Compose<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 = <B as Behavior>::Event

Source§

type Sends = Sends

Source§

type Ph = Ph

Source§

type Error = <B as Behavior>::Error

Source§

type Birth = Br

Source§

fn init(&mut self) -> Result<Actions<A, Ph, Sends, Br>, B::Error>

Produce initialization actions before the first event is accepted. Read more
Source§

fn transition( &mut self, event: B::Event, ) -> Result<Actions<A, Ph, Sends, Br>, B::Error>

Fold exactly one event into explicit actions and the next behavior. Read more
Source§

fn receive( &mut self, from: Self::Addr, message: Self::Msg, ) -> BehaviorActed<Self>
where Self: Sized,

Fold one user communication through the composed protocol. Read more
Source§

fn on<Input>(&mut self, input: Input) -> BehaviorActed<Self>
where Self: Sized, Self::Event: EventInput<Input>,

Inject one supported semantic input and fold it through this behavior. Read more

Auto Trait Implementations§

§

impl<B> Freeze for Compose<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for Compose<B>
where B: RefUnwindSafe,

§

impl<B> Send for Compose<B>
where B: Send,

§

impl<B> Sync for Compose<B>
where B: Sync,

§

impl<B> Unpin for Compose<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for Compose<B>
where B: UnsafeUnpin,

§

impl<B> UnwindSafe for Compose<B>
where B: 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.