[][src]Trait yew::agent::Agent

pub trait Agent: Sized + 'static {
    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 is_module() -> bool { ... } }

Declares the behavior of the agent.

Associated Types

type Reach: Discoverer<Agent = Self>

Reach capability of the agent.

type Message

Type of an input message.

type Input

Incoming message type.

type Output

Outgoing message type.

Loading content...

Required methods

fn create(link: AgentLink<Self>) -> Self

Creates an instance of an agent.

fn update(&mut self, msg: Self::Message)

This method called on every update message.

fn handle_input(&mut self, msg: Self::Input, id: HandlerId)

This method called on every incoming message.

Loading content...

Provided methods

fn connected(&mut self, _id: HandlerId)

This method called on when a new bridge created.

fn disconnected(&mut self, _id: HandlerId)

This method called on when a new bridge destroyed.

fn destroy(&mut self)

This method called when the agent is destroyed.

fn name_of_resource() -> &'static str

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

fn is_module() -> bool

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

Loading content...

Implementors

Loading content...