pub trait RequestHandler:
Send
+ Sync
+ 'static {
// Required method
fn handle(
&self,
request: JmapRequest,
) -> impl Future<Output = Result<JmapResponse, JmapError>> + Send;
// Provided method
fn prepare_problem(&self, problem: &mut ProblemDetails) { ... }
}Available on crate feature
server only.Expand description
Answers the Requests of one connection.
Implement it to add work around each dispatch (a using check, state
change notification, metrics), or use DispatcherHandler.
Required Methods§
Sourcefn handle(
&self,
request: JmapRequest,
) -> impl Future<Output = Result<JmapResponse, JmapError>> + Send
fn handle( &self, request: JmapRequest, ) -> impl Future<Output = Result<JmapResponse, JmapError>> + Send
Process one parsed Request. Err is a request-level error (RFC
8620 §3.6.1, e.g. unknownCapability) and is sent as a
RequestError; method-level errors belong in the Response.
Provided Methods§
Sourcefn prepare_problem(&self, problem: &mut ProblemDetails)
fn prepare_problem(&self, problem: &mut ProblemDetails)
Called on every RequestError before it is sent, including those
the driver makes itself. Set a localized title here (RFC 9457
§3.1.3); the default leaves the problem as it is.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".