Trait gloo_worker::Dispatched [−][src]
pub trait Dispatched: Worker + Sized + 'static {
fn dispatcher() -> Dispatcher<Self>;
}
Expand description
This trait allows the creation of a dispatcher to an existing worker that will not send replies when messages are sent.
Required methods
fn dispatcher() -> Dispatcher<Self>
fn dispatcher() -> Dispatcher<Self>
Creates a dispatcher to the worker that will not send messages back.
Note
Dispatchers don’t have HandlerId
s and therefore Worker::handle
will be supplied None
for the id
parameter, and connected
and disconnected
will not be called.
Important
Because the Workers using Context or Public reaches use the number of existing bridges to keep track of if the worker itself should exist, creating dispatchers will not guarantee that an Worker will exist to service requests sent from Dispatchers. You must keep at least one bridge around if you wish to use a dispatcher. If you are using workers in a write-only manner, then it is suggested that you create a bridge that handles no-op responses as high up in the component hierarchy as possible - oftentimes the root component for simplicity’s sake.