pub trait ResponseCode {
const OK: Self;
const BAD_REQUEST: Self;
const INTERNAL_SERVER_ERROR: Self;
// Required methods
fn status_code(&self) -> u16;
fn is_success(&self) -> bool;
// Provided methods
fn type_uri(&self) -> Option<SharedString> { ... }
fn title(&self) -> Option<SharedString> { ... }
fn message(&self) -> Option<SharedString> { ... }
}Expand description
Trait for response code. See Problem Details for HTTP APIs.
Required Associated Constants§
Sourceconst BAD_REQUEST: Self
const BAD_REQUEST: Self
400 Bad Request.
Sourceconst INTERNAL_SERVER_ERROR: Self
const INTERNAL_SERVER_ERROR: Self
500 Internal Server Error.
Required Methods§
Sourcefn status_code(&self) -> u16
fn status_code(&self) -> u16
Status code.
Sourcefn is_success(&self) -> bool
fn is_success(&self) -> bool
Returns true if the response is successful.
Provided Methods§
Sourcefn type_uri(&self) -> Option<SharedString>
fn type_uri(&self) -> Option<SharedString>
A URI reference that identifies the problem type.
For successful response, it should be None.
Sourcefn title(&self) -> Option<SharedString>
fn title(&self) -> Option<SharedString>
A short, human-readable summary of the problem type.
For successful response, it should be None.
Sourcefn message(&self) -> Option<SharedString>
fn message(&self) -> Option<SharedString>
A context-specific descriptive message. If the response is not successful, it should be a human-readable explanation specific to this occurrence of the problem.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".