main::models::agent_basic::basic_traits

Trait BasicTraits

source
pub trait BasicTraits {
    // Required methods
    fn new(objective: String, position: String) -> Self;
    fn update_state(&mut self, new_state: AgentState);
    fn get_objective(&self) -> &String;
    fn get_position(&self) -> &String;
    fn get_state(&self) -> &AgentState;
    fn get_memory(&self) -> &Vec<Message>;
}
Expand description

Defines the basic traits that an agent must implement for managing its state, objective, position, and memory.

Required Methods§

source

fn new(objective: String, position: String) -> Self

Creates a new instance of the implementing type with the given objective and position.

§Parameters
  • objective: The main goal or purpose of the agent.
  • position: The role or title of the agent.
§Returns

A new instance of the implementing type.

source

fn update_state(&mut self, new_state: AgentState)

Updates the state of the agent.

§Parameters
  • new_state: The new state to transition the agent to.
source

fn get_objective(&self) -> &String

Retrieves the objective of the agent.

§Returns

A reference to the agent’s objective as a String.

source

fn get_position(&self) -> &String

Retrieves the position or role of the agent.

§Returns

A reference to the agent’s position as a String.

source

fn get_state(&self) -> &AgentState

Retrieves the current state of the agent.

§Returns

A reference to the agent’s current state as an AgentState.

source

fn get_memory(&self) -> &Vec<Message>

Retrieves the memory of the agent, which contains logged messages or information.

§Returns

A reference to the agent’s memory as a Vec<Message>.

Object Safety§

This trait is not object safe.

Implementors§