pub trait Agent: Sized + 'static {
type Reach: Discoverer<Agent = Self>;
type Message;
type Input;
type Output;
// Required methods
fn create(link: AgentLink<Self>) -> Self;
fn update(&mut self, msg: Self::Message);
fn handle_input(&mut self, msg: Self::Input, id: HandlerId);
// Provided methods
fn connected(&mut self, _id: HandlerId) { ... }
fn disconnected(&mut self, _id: HandlerId) { ... }
fn destroy(&mut self) { ... }
fn name_of_resource() -> &'static str { ... }
fn is_module() -> bool { ... }
}
Expand description
Declares the behavior of the agent.
Required Associated Types§
Required Methods§
Sourcefn handle_input(&mut self, msg: Self::Input, id: HandlerId)
fn handle_input(&mut self, msg: Self::Input, id: HandlerId)
This method called on every incoming message.
Provided Methods§
Sourcefn disconnected(&mut self, _id: HandlerId)
fn disconnected(&mut self, _id: HandlerId)
This method called on when a new bridge destroyed.
Sourcefn name_of_resource() -> &'static str
fn name_of_resource() -> &'static str
Represents the name of loading resorce for remote workers which have to live in a separate files.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.