pub trait Agent: 'static + Sized {
    type Reach: Discoverer<Agent = Self>;
    type Message;
    type Input;
    type Output;

    fn create(link: AgentLink<Self>) -> Self;
    fn update(&mut self, msg: Self::Message);
    fn handle_input(&mut self, msg: Self::Input, id: HandlerId);

    fn connected(&mut self, _id: HandlerId) { ... }
    fn disconnected(&mut self, _id: HandlerId) { ... }
    fn destroy(&mut self) { ... }
    fn name_of_resource() -> &'static str { ... }
    fn resource_path_is_relative() -> bool { ... }
    fn is_module() -> bool { ... }
}
Expand description

Declares the behavior of the agent.

Required Associated Types

Reach capability of the agent.

Type of an input message.

Incoming message type.

Outgoing message type.

Required Methods

Creates an instance of an agent.

This method called on every update message.

This method called on every incoming message.

Provided Methods

This method called on when a new bridge created.

This method called on when a new bridge destroyed.

This method called when the agent is destroyed.

Represents the name of loading resorce for remote workers which have to live in a separate files.

Indicates whether the name of the resource is relative.

The default implementation returns false, which will cause the result returned by Self::name_of_resource to be interpreted as an absolute URL. If true is returned, it will be interpreted as a relative URL.

Signifies if resource is a module. This has pending browser support.

Implementors

This is a wrapper, intended to be used as an opaque machinery allowing the Store to do it’s things.