Trait arbiter_engine::machine::Behavior
source · pub trait Behavior<E: Send + 'static>: Serialize + DeserializeOwned + Send + Sync + Debug + 'static {
// Required method
fn startup<'life0, 'async_trait>(
&'life0 mut self,
client: Arc<ArbiterMiddleware>,
messager: Messager
) -> Pin<Box<dyn Future<Output = Result<Option<EventStream<E>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn process<'life0, 'async_trait>(
&'life0 mut self,
_event: E
) -> Pin<Box<dyn Future<Output = Result<ControlFlow>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
The Behavior trait is the lowest level functionality that will be used
by a StateMachine. This constitutes what each state transition will do.
Required Methods§
sourcefn startup<'life0, 'async_trait>(
&'life0 mut self,
client: Arc<ArbiterMiddleware>,
messager: Messager
) -> Pin<Box<dyn Future<Output = Result<Option<EventStream<E>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn startup<'life0, 'async_trait>(
&'life0 mut self,
client: Arc<ArbiterMiddleware>,
messager: Messager
) -> Pin<Box<dyn Future<Output = Result<Option<EventStream<E>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Used to start the agent. This is where the agent can engage in its specific start up activities that it can do given the current state of the world.
Provided Methods§
sourcefn process<'life0, 'async_trait>(
&'life0 mut self,
_event: E
) -> Pin<Box<dyn Future<Output = Result<ControlFlow>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 mut self,
_event: E
) -> Pin<Box<dyn Future<Output = Result<ControlFlow>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Used to process events. This is where the agent can engage in its specific processing of events that can lead to actions being taken.
Object Safety§
This trait is not object safe.