pub trait Activate: Behavior + Sized {
// Provided method
fn initialize(self) -> Result<Initialized<Self>, Self::Error> { ... }
}Expand description
Consuming initialization for any concrete behavior definition.
This trait makes standalone catalogue templates directly usable without a wrapper construction. Initialization is a lifecycle transition, not a wrapper transformation.
A raw definition cannot use the active mailbox API:
ⓘ
let mut definition = behavior_actors::Machine::<behavior::MailAddr, _, _, _, behavior::Never>::new(
(),
(),
|_, _, _| Ok(behavior_actors::Move::Stay),
);
definition.receive(behavior::MailAddr(0), 1_u8);Provided Methods§
Sourcefn initialize(self) -> Result<Initialized<Self>, Self::Error>
fn initialize(self) -> Result<Initialized<Self>, Self::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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.