Skip to main content

AgentType

Trait AgentType 

Source
pub trait AgentType<StateId: IndexLike, Payload: DataLike>: AgentInstances<StateId, Payload> {
    // Required methods
    fn reaction(
        &self,
        instance: usize,
        state_ids: &[StateId],
        payload: &Payload,
    ) -> Reaction<StateId, Payload>;
    fn activity(
        &self,
        instance: usize,
        state_ids: &[StateId],
    ) -> Activity<Payload>;
    fn state_is_deferring(&self, instance: usize, state_ids: &[StateId]) -> bool;
    fn state_invalid_because(
        &self,
        instance: usize,
        state_ids: &[StateId],
    ) -> Option<&'static str>;
    fn state_max_in_flight_messages(
        &self,
        instance: usize,
        state_ids: &[StateId],
    ) -> Option<usize>;
    fn states_count(&self) -> usize;
    fn compute_terse(&self);
}
Expand description

A trait fully describing some agent instances of the same type.

Required Methods§

Source

fn reaction( &self, instance: usize, state_ids: &[StateId], payload: &Payload, ) -> Reaction<StateId, Payload>

Return the actions that may be taken by an agent instance with some state when receiving a payload.

Source

fn activity(&self, instance: usize, state_ids: &[StateId]) -> Activity<Payload>

Return the actions that may be taken by an agent with some state when time passes.

Source

fn state_is_deferring(&self, instance: usize, state_ids: &[StateId]) -> bool

Whether any agent in the state is deferring messages.

Source

fn state_invalid_because( &self, instance: usize, state_ids: &[StateId], ) -> Option<&'static str>

Return a reason that a state is invalid (unless it is valid).

Source

fn state_max_in_flight_messages( &self, instance: usize, state_ids: &[StateId], ) -> Option<usize>

The maximal number of messages sent by an agent which may be in-flight when it is in the state.

Source

fn states_count(&self) -> usize

The total number of states seen so far.

Source

fn compute_terse(&self)

Compute mapping from full states to terse states (name only).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<State: DataLike + AgentState<State, Payload>, StateId: IndexLike, Payload: DataLike> AgentType<StateId, Payload> for AgentTypeData<State, StateId, Payload>

Source§

impl<State: DataLike + ContainerOf1State<State, Part, Payload>, Part: DataLike + AgentState<Part, Payload>, StateId: IndexLike, Payload: DataLike, const MAX_PARTS: usize> AgentType<StateId, Payload> for ContainerOf1TypeData<State, Part, StateId, Payload, MAX_PARTS>

Source§

impl<State: DataLike + ContainerOf2State<State, Part1, Part2, Payload>, Part1: DataLike + AgentState<Part1, Payload>, Part2: DataLike + AgentState<Part2, Payload>, StateId: IndexLike, Payload: DataLike, const MAX_PARTS: usize> AgentType<StateId, Payload> for ContainerOf2TypeData<State, Part1, Part2, StateId, Payload, MAX_PARTS>