pub struct Compose<B> { /* private fields */ }Expand description
A behavior definition that may still be wrapped and initialized.
Definitions deliberately expose no mailbox fold:
use behavior::{Compose, Machine, MailAddr, Move, Never};
let mut definition: Compose<Machine<MailAddr, (), u8, (), Never>> =
Compose::new(Machine::new((), (), |_, _, _| Ok(Move::Stay)));
definition.receive(MailAddr(0), 1);Implementations§
Source§impl<B: Behavior> Compose<B>
impl<B: Behavior> Compose<B>
pub fn base(&self) -> &B::Basewhere
B: BehaviorBase,
pub fn definition(&self) -> &B
Sourcepub fn initialize(self) -> Result<Initialized<B>, B::Error>
pub fn initialize(self) -> Result<Initialized<B>, B::Error>
Consume this definition, perform its one initialization fold, and return the active behavior together with the ordered initialization effects.
§Errors
Returns the behavior’s controlled initialization failure. A failed definition is consumed and cannot be activated or retried.
Sourcepub fn stop_on_shutdown(self) -> Compose<StopOnShutdown<B>>
pub fn stop_on_shutdown(self) -> Compose<StopOnShutdown<B>>
Stop normally when a typed shutdown request is folded.
Sourcepub fn finalize_on_shutdown(
self,
finalize: ShutdownReaction<B>,
) -> Compose<FinalizeOnShutdown<B>>
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.
Sourcepub fn watch(
self,
peer: B::Addr,
on_stopped: LinkReaction<B>,
) -> Compose<Watch<B>>
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.
Sourcepub fn deadline(
self,
timer: TimerId,
when: Option<Instant>,
on_reached: DeadlineReaction<B>,
) -> Compose<Deadline<B>>
pub fn deadline( self, timer: TimerId, when: Option<Instant>, on_reached: DeadlineReaction<B>, ) -> Compose<Deadline<B>>
Apply a pure reaction when the given absolute time is reached.
Sourcepub fn receive_timeout(
self,
timer: TimerId,
after: Duration,
on_elapsed: ReceiveTimeoutReaction<B>,
) -> Compose<ReceiveTimeout<B>>
pub fn receive_timeout( self, timer: TimerId, 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.
Sourcepub fn stash(self, route: fn(&B::Msg) -> StashRoute) -> Compose<Stash<B>>
pub fn stash(self, route: fn(&B::Msg) -> StashRoute) -> Compose<Stash<B>>
Hold messages selected by route and replay them on Release.
Sourcepub fn children<C>(
self,
nonces: fn(usize) -> <B::Addr as Address>::Nonce,
count: usize,
build: fn(usize) -> Option<C>,
) -> Result<Compose<Supervisor<B, C>>, FleetError<<B::Addr as Address>::Nonce>>
pub fn children<C>( self, nonces: fn(usize) -> <B::Addr as Address>::Nonce, count: usize, build: fn(usize) -> Option<C>, ) -> Result<Compose<Supervisor<B, C>>, FleetError<<B::Addr as Address>::Nonce>>
Create a supervised child topology with an explicit creator-local nonce assignment. Bombay does not infer routing identity from an integer position.
Source§impl<B, C> Compose<Supervisor<B, C>>
impl<B, C> Compose<Supervisor<B, C>>
pub fn restart(self, strategy: Strategy) -> Self
pub fn when(self, policy: RestartPolicy) -> Self
pub fn within(self, maximum: u32, window: Duration) -> Self
Sourcepub fn on_supervision_failure(
self,
reaction: SupervisionFailureReaction<B>,
) -> Self
pub fn on_supervision_failure( self, reaction: SupervisionFailureReaction<B>, ) -> Self
Apply a pure reaction when supervision can no longer preserve its child topology.