client: Use ResponseResult type alias in more places

This commit is contained in:
Jonas Platte 2021-04-28 14:05:29 +02:00
parent 71b4463306
commit 9bbad70592
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -155,10 +155,7 @@ impl<C: DefaultConstructibleHttpClient> Client<C> {
impl<C: HttpClient> Client<C> { impl<C: HttpClient> Client<C> {
/// Makes a request to a Matrix API endpoint. /// Makes a request to a Matrix API endpoint.
pub async fn send_request<R: OutgoingRequest>( pub async fn send_request<R: OutgoingRequest>(&self, request: R) -> ResponseResult<C, R> {
&self,
request: R,
) -> Result<R::IncomingResponse, Error<C::Error, R::EndpointError>> {
self.send_customized_request(request, |_| {}).await self.send_customized_request(request, |_| {}).await
} }
@ -167,7 +164,7 @@ impl<C: HttpClient> Client<C> {
&self, &self,
request: R, request: R,
customize: F, customize: F,
) -> Result<R::IncomingResponse, Error<C::Error, R::EndpointError>> ) -> ResponseResult<C, R>
where where
R: OutgoingRequest, R: OutgoingRequest,
F: FnOnce(&mut http::Request<C::RequestBody>), F: FnOnce(&mut http::Request<C::RequestBody>),
@ -195,7 +192,7 @@ fn send_customized_request<'a, C, R, F>(
send_access_token: SendAccessToken<'_>, send_access_token: SendAccessToken<'_>,
request: R, request: R,
customize: F, customize: F,
) -> impl Future<Output = Result<R::IncomingResponse, Error<C::Error, R::EndpointError>>> + Send + 'a ) -> impl Future<Output = ResponseResult<C, R>> + Send + 'a
where where
C: HttpClient + ?Sized, C: HttpClient + ?Sized,
R: OutgoingRequest, R: OutgoingRequest,