Trait IncomingRequest
pub trait IncomingRequest: Metadata {
type EndpointError: EndpointError;
type OutgoingResponse: OutgoingResponse;
// Required method
fn try_from_http_request<B, S>(
req: Request<B>,
path_args: &[S],
) -> Result<Self, FromHttpRequestError>
where B: AsRef<[u8]>,
S: AsRef<str>;
// Provided method
fn check_request_method(method: &Method) -> Result<(), FromHttpRequestError> { ... }
}Expand description
A request type for a Matrix API endpoint, used for receiving requests.
Required Associated Types§
type EndpointError: EndpointError
type EndpointError: EndpointError
A type capturing the error conditions that can be returned in the response.
type OutgoingResponse: OutgoingResponse
type OutgoingResponse: OutgoingResponse
Response type to return when the request is successful.
Required Methods§
fn try_from_http_request<B, S>(
req: Request<B>,
path_args: &[S],
) -> Result<Self, FromHttpRequestError>
fn try_from_http_request<B, S>( req: Request<B>, path_args: &[S], ) -> Result<Self, FromHttpRequestError>
Tries to turn the given http::Request into this request type,
together with the corresponding path arguments.
Note: The strings in path_args need to be percent-decoded.
Provided Methods§
fn check_request_method(method: &Method) -> Result<(), FromHttpRequestError>
fn check_request_method(method: &Method) -> Result<(), FromHttpRequestError>
Check whether the given HTTP method from an incoming request is compatible with the expected
METHOD of this endpoint.
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.