Agent

Trait Agent 

Source
pub trait Agent {
    // Required methods
    fn new(
        askit: ASKit,
        id: String,
        def_name: String,
        config: Option<AgentConfig>,
    ) -> Result<Self, AgentError>
       where Self: Sized;
    fn askit(&self) -> &ASKit;
    fn id(&self) -> &str;
    fn status(&self) -> &AgentStatus;
    fn def_name(&self) -> &str;
    fn config(&self) -> Option<&AgentConfig>;
    fn set_config(&mut self, config: AgentConfig) -> Result<(), AgentError>;
    fn start(&mut self) -> Result<(), AgentError>;
    fn stop(&mut self) -> Result<(), AgentError>;
    fn process<'life0, 'async_trait>(
        &'life0 mut self,
        ctx: AgentContext,
        data: AgentData,
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn get_global_config(&self) -> Option<AgentConfig> { ... }
}

Required Methods§

Source

fn new( askit: ASKit, id: String, def_name: String, config: Option<AgentConfig>, ) -> Result<Self, AgentError>
where Self: Sized,

Source

fn askit(&self) -> &ASKit

Source

fn id(&self) -> &str

Source

fn status(&self) -> &AgentStatus

Source

fn def_name(&self) -> &str

Source

fn config(&self) -> Option<&AgentConfig>

Source

fn set_config(&mut self, config: AgentConfig) -> Result<(), AgentError>

Source

fn start(&mut self) -> Result<(), AgentError>

Source

fn stop(&mut self) -> Result<(), AgentError>

Source

fn process<'life0, 'async_trait>( &'life0 mut self, ctx: AgentContext, data: AgentData, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Implementors§

Source§

impl<T: AsAgent + Send + Sync> Agent for T