pub struct Active<B: Behavior> { /* private fields */ }Expand description
A behavior whose initialization fold has completed exactly once.
Active<B> does not implement Behavior, so initialization cannot be
repeated through the public API:
ⓘ
let definition = behavior_actors::Machine::<behavior::MailAddr, _, _, _, behavior::Never>::new(
(),
(),
|_, _, _| Ok(behavior_actors::Move::Stay),
);
let active = behavior_actors::Activate::initialize(definition).unwrap().behavior;
behavior_actors::Activate::initialize(active);Implementations§
Source§impl<B: Behavior> Active<B>
impl<B: Behavior> Active<B>
Sourcepub fn base(&self) -> &B::Basewhere
B: BehaviorBase,
pub fn base(&self) -> &B::Basewhere
B: BehaviorBase,
Inspect the authored base behavior through any wrapper depth.
Sourcepub fn stashed(&self) -> usizewhere
B: StashStatus,
pub fn stashed(&self) -> usizewhere
B: StashStatus,
Return the number of messages held by a composed stash layer.
Sourcepub fn transition(&mut self, event: B::Event) -> BehaviorActed<B>
pub fn transition(&mut self, event: B::Event) -> BehaviorActed<B>
Fold exactly one event after initialization.
§Errors
Returns the behavior’s declared controlled transition failure.
Sourcepub fn receive(
&mut self,
from: BehaviorAddr<B>,
message: BehaviorMessage<B>,
) -> BehaviorActed<B>
pub fn receive( &mut self, from: BehaviorAddr<B>, message: BehaviorMessage<B>, ) -> BehaviorActed<B>
Fold one user communication after initialization.
§Errors
Returns the behavior’s declared controlled transition failure.
Sourcepub fn on<Input>(&mut self, input: Input) -> BehaviorActed<B>
pub fn on<Input>(&mut self, input: Input) -> BehaviorActed<B>
Fold one statically supported semantic input after initialization.
§Errors
Returns the behavior’s declared controlled transition failure.
Sourcepub fn on_path<Input, Path>(&mut self, input: Input) -> BehaviorActed<B>where
B::Event: InjectEvent<Input, Path>,
pub fn on_path<Input, Path>(&mut self, input: Input) -> BehaviorActed<B>where
B::Event: InjectEvent<Input, Path>,
Fold one semantic input through an explicitly proven structural path.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for Active<B>where
B: Freeze,
impl<B> RefUnwindSafe for Active<B>where
B: RefUnwindSafe,
impl<B> Send for Active<B>where
B: Send,
impl<B> Sync for Active<B>where
B: Sync,
impl<B> Unpin for Active<B>where
B: Unpin,
impl<B> UnsafeUnpin for Active<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for Active<B>where
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more