Agent

Trait Agent 

Source
pub trait Agent:
    Send
    + Sync
    + 'static {
Show 19 methods // Required methods fn new( askit: ASKit, id: String, spec: AgentSpec, ) -> Result<Self, AgentError> where Self: Sized; fn askit(&self) -> &ASKit; fn id(&self) -> &str; fn status(&self) -> &AgentStatus; fn spec(&self) -> &AgentSpec; fn update_spec(&mut self, spec_update: &Value) -> Result<(), AgentError>; fn def_name(&self) -> &str; fn configs(&self) -> Result<&AgentConfigs, AgentError>; fn set_config( &mut self, key: String, value: AgentValue, ) -> Result<(), AgentError>; fn set_configs(&mut self, configs: AgentConfigs) -> Result<(), AgentError>; fn stream_id(&self) -> &str; fn set_stream_id(&mut self, stream_id: String); fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn process<'life0, 'async_trait>( &'life0 mut self, ctx: AgentContext, pin: String, value: AgentValue, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; // Provided methods fn get_global_configs(&self) -> Option<AgentConfigs> { ... } fn runtime(&self) -> &Runtime { ... }
}
Expand description

The core trait for all agents.

Required Methods§

Source

fn new(askit: ASKit, id: String, spec: AgentSpec) -> Result<Self, AgentError>
where Self: Sized,

Source

fn askit(&self) -> &ASKit

Source

fn id(&self) -> &str

Source

fn status(&self) -> &AgentStatus

Source

fn spec(&self) -> &AgentSpec

Source

fn update_spec(&mut self, spec_update: &Value) -> Result<(), AgentError>

Source

fn def_name(&self) -> &str

Source

fn configs(&self) -> Result<&AgentConfigs, AgentError>

Source

fn set_config( &mut self, key: String, value: AgentValue, ) -> Result<(), AgentError>

Source

fn set_configs(&mut self, configs: AgentConfigs) -> Result<(), AgentError>

Source

fn stream_id(&self) -> &str

Source

fn set_stream_id(&mut self, stream_id: String)

Source

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

Source

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

Source

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

Source

fn as_any(&self) -> &dyn Any

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Provided Methods§

Implementations§

Source§

impl dyn Agent

Source

pub fn as_agent<T: Agent>(&self) -> Option<&T>

Source

pub fn as_agent_mut<T: Agent>(&mut self) -> Option<&mut T>

Implementors§

Source§

impl<T: AsAgent> Agent for T