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§
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
Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".