pub trait ClientCallback {
type Error;
// Required method
fn dispatch(
&self,
request: &CallbackRequest,
payloads: &[PayloadEnvelope],
) -> Result<CallbackResponse, Self::Error>;
}Expand description
Pluggable client-callback seam.
A ClientCallback is whatever the consumer plugs in to actually
deliver a CallbackRequest and produce a CallbackResponse.
In tests this is typically an inline closure; in production it
might wrap an HTTP/IPC transport or a renderer-backed in-process
dispatch (issue #3 will provide a renderer-backed implementation).
Implementations MUST treat payload bodies as opaque and MUST NOT
mutate CallbackRequest in place.
Required Associated Types§
Required Methods§
Sourcefn dispatch(
&self,
request: &CallbackRequest,
payloads: &[PayloadEnvelope],
) -> Result<CallbackResponse, Self::Error>
fn dispatch( &self, request: &CallbackRequest, payloads: &[PayloadEnvelope], ) -> Result<CallbackResponse, Self::Error>
Deliver request (alongside any opaque payloads) to the
client and return its CallbackResponse.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".