pub trait Dispatched:
Agent
+ Sized
+ 'static {
// Required method
fn dispatcher() -> Dispatcher<Self>;
}
Expand description
This trait allows the creation of a dispatcher to an existing agent that will not send replies when messages are sent.
Required Methods§
Sourcefn dispatcher() -> Dispatcher<Self>
fn dispatcher() -> Dispatcher<Self>
Creates a dispatcher to the agent that will not send messages back.
§Note
Dispatchers don’t have HandlerId
s and therefore Agent::handle
will be supplied None
for the id
parameter, and connected
and disconnected
will not be called.
§Important
Because the Agents using Context or Public reaches use the number of existing bridges to keep track of if the agent itself should exist, creating dispatchers will not guarantee that an Agent 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 agents 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.
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.