Skip to main content

Compose

Struct Compose 

Source
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> Compose<B>

Source

pub const fn new(behavior: B) -> Self

Begin a composition from the one concrete Behavior value being defined directly or by #[behavior].

Source§

impl<B: Behavior> Compose<B>

Source

pub fn base(&self) -> &B::Base
where B: BehaviorBase,

Source

pub fn definition(&self) -> &B

Source

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.

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, timer: TimerId, when: Option<Instant>, on_reached: DeadlineReaction<B>, ) -> Compose<Deadline<B>>

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

Source

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.

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, 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>>
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 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>>
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.

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.