pub trait Request: Sized + Clone {
type Response: Response;
const METADATA: Metadata;
// Required method
fn try_into_http_request<T>(
self,
ctx: Context<'_>,
) -> Result<Request<T>, IntoHttpError>
where T: Default + BufMut;
}
Expand description
Trait for requests.
All requests in the API should implement this trait. It provides a method to convert the request into an HTTP request.
The implementing type can perform any necessary validation on the request before converting it into an HTTP request.
The Self::Response
associated type is the type that should be used to represent the response
returned by the server.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn try_into_http_request<T>(
self,
ctx: Context<'_>,
) -> Result<Request<T>, IntoHttpError>
fn try_into_http_request<T>( self, ctx: Context<'_>, ) -> Result<Request<T>, IntoHttpError>
Tries to convert the request into an HTTP request.
On endpoints requiring authentication, the token
field in ctx
should be provided.
If not, the request will fail to convert.
§Arguments
ctx
: The context for the request.
§Errors
This function will return an error if the request cannot be converted into an HTTP request.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.