pub trait AgentState<State: DataLike, Payload: DataLike> {
// Required method
fn reaction(
&self,
instance: usize,
payload: &Payload,
) -> Reaction<State, Payload>;
// Provided methods
fn activity(&self, _instance: usize) -> Activity<Payload> { ... }
fn is_deferring(&self, _instance: usize) -> bool { ... }
fn invalid_because(&self, _instance: usize) -> Option<&'static str> { ... }
fn max_in_flight_messages(&self, _instance: usize) -> Option<usize> { ... }
}Expand description
A trait for a single agent state.
Required Methods§
Provided Methods§
Sourcefn activity(&self, _instance: usize) -> Activity<Payload>
fn activity(&self, _instance: usize) -> Activity<Payload>
Return the actions that may be taken by an agent with some state when time passes.
Sourcefn is_deferring(&self, _instance: usize) -> bool
fn is_deferring(&self, _instance: usize) -> bool
Whether any agent in this state is deferring messages.
Sourcefn invalid_because(&self, _instance: usize) -> Option<&'static str>
fn invalid_because(&self, _instance: usize) -> Option<&'static str>
If this object is invalid, return why.
Sourcefn max_in_flight_messages(&self, _instance: usize) -> Option<usize>
fn max_in_flight_messages(&self, _instance: usize) -> Option<usize>
The maximal number of messages sent by this agent which may be in-flight when it is in this state.