pub struct HttpResponseHandler;Expand description
Response handler for HTTP messages
Implementations§
Source§impl HttpResponseHandler
impl HttpResponseHandler
Sourcepub fn parse_response<T>(
&self,
response: &HttpResponse,
) -> Result<ApiResponse<T>, HttpError>where
T: for<'de> Deserialize<'de>,
pub fn parse_response<T>(
&self,
response: &HttpResponse,
) -> Result<ApiResponse<T>, HttpError>where
T: for<'de> Deserialize<'de>,
Parse HTTP response
Sourcepub fn is_success(&self, response: &HttpResponse) -> bool
pub fn is_success(&self, response: &HttpResponse) -> bool
Check if response is successful
Sourcepub fn extract_error<'a, T>(
&self,
api_response: &'a ApiResponse<T>,
) -> Option<&'a ApiError>
pub fn extract_error<'a, T>( &self, api_response: &'a ApiResponse<T>, ) -> Option<&'a ApiError>
Extract error from API response
Sourcepub fn extract_result<'a, T>(
&self,
api_response: &'a ApiResponse<T>,
) -> Option<&'a T>
pub fn extract_result<'a, T>( &self, api_response: &'a ApiResponse<T>, ) -> Option<&'a T>
Extract result from API response
Sourcepub fn handle_rate_limit(
&self,
response: &HttpResponse,
) -> Result<(), HttpError>
pub fn handle_rate_limit( &self, response: &HttpResponse, ) -> Result<(), HttpError>
Handle rate limiting
Sourcepub fn handle_auth_error(
&self,
response: &HttpResponse,
) -> Result<(), HttpError>
pub fn handle_auth_error( &self, response: &HttpResponse, ) -> Result<(), HttpError>
Handle authentication errors
Trait Implementations§
Source§impl Clone for HttpResponseHandler
impl Clone for HttpResponseHandler
Source§fn clone(&self) -> HttpResponseHandler
fn clone(&self) -> HttpResponseHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpResponseHandler
impl Debug for HttpResponseHandler
Source§impl Default for HttpResponseHandler
impl Default for HttpResponseHandler
Source§impl<'de> Deserialize<'de> for HttpResponseHandler
impl<'de> Deserialize<'de> for HttpResponseHandler
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for HttpResponseHandler
impl Display for HttpResponseHandler
Auto Trait Implementations§
impl Freeze for HttpResponseHandler
impl RefUnwindSafe for HttpResponseHandler
impl Send for HttpResponseHandler
impl Sync for HttpResponseHandler
impl Unpin for HttpResponseHandler
impl UnwindSafe for HttpResponseHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.