Trait yew_agent::Worker

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

    fn create(link: WorkerLink<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 worker.

Required Associated Types§

Reach capability of the worker.

Type of an input message.

Incoming message type.

Outgoing message type.

Required Methods§

Creates an instance of an worker.

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 worker is destroyed.

Represents the name of loading resource 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§