Skip to main content

ClientCallback

Trait ClientCallback 

Source
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§

Source

type Error

Error produced by the client transport. Kept generic so an in-process impl, a renderer-backed impl, and a network impl can each carry their own diagnostic shape.

Required Methods§

Source

fn dispatch( &self, request: &CallbackRequest, payloads: &[PayloadEnvelope], ) -> Result<CallbackResponse, Self::Error>

Deliver request (alongside any opaque payloads) to the client and return its CallbackResponse.

Implementors§