pub trait TypedServiceResult: Send + Sync {
// Required methods
fn message(&self) -> &str;
fn code(&self) -> u16;
fn response_type(&self) -> ResponseType;
fn serialize(&self) -> Result<String, Error>;
// Provided method
fn data_json(&self) -> Option<Value> { ... }
}Expand description
Renderable handler result: message, HTTP status, content type, and body serializer.
Implemented by ServiceResult, GenericTypedResult, and ErrorResult, so
handlers can return them as Box<dyn TypedServiceResult> for mixed payload shapes.
Required Methods§
Sourcefn response_type(&self) -> ResponseType
fn response_type(&self) -> ResponseType
Content type used for the Content-Type header.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".