pub struct HttpStatusError {
pub status: StatusCode,
pub retry_after: Option<Duration>,
}Expand description
A typed HTTP status carried inside a crate::errors::CrawlError.
§Examples
use http::StatusCode;
use millipede_core::http_client::HttpStatusError;
let error = HttpStatusError::new(StatusCode::TOO_MANY_REQUESTS);
assert_eq!(error.status, StatusCode::TOO_MANY_REQUESTS);Fields§
§status: StatusCodeThe response status.
retry_after: Option<Duration>Parsed Retry-After response header, when the response carried one.
Implementations§
Source§impl HttpStatusError
impl HttpStatusError
Sourcepub fn new(status: StatusCode) -> Self
pub fn new(status: StatusCode) -> Self
Creates a status carrier.
Sourcepub fn with_retry_after(self, retry_after: Duration) -> Self
pub fn with_retry_after(self, retry_after: Duration) -> Self
Attaches a parsed Retry-After duration.
Trait Implementations§
Source§impl Clone for HttpStatusError
impl Clone for HttpStatusError
Source§fn clone(&self) -> HttpStatusError
fn clone(&self) -> HttpStatusError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for HttpStatusError
Source§impl Debug for HttpStatusError
impl Debug for HttpStatusError
Source§impl Display for HttpStatusError
impl Display for HttpStatusError
impl Eq for HttpStatusError
Source§impl Error for HttpStatusError
impl Error for HttpStatusError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for HttpStatusError
impl PartialEq for HttpStatusError
impl StructuralPartialEq for HttpStatusError
Auto Trait Implementations§
impl Freeze for HttpStatusError
impl RefUnwindSafe for HttpStatusError
impl Send for HttpStatusError
impl Sync for HttpStatusError
impl Unpin for HttpStatusError
impl UnsafeUnpin for HttpStatusError
impl UnwindSafe for HttpStatusError
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