#[non_exhaustive]pub struct HttpResponse {
pub status: u16,
pub body: Vec<u8>,
pub retry_after: Option<Duration>,
}Expand description
One HTTP reply.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.status: u16The status code.
body: Vec<u8>The body.
retry_after: Option<Duration>How long the server asked you to wait, when it sent Retry-After.
Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn new(status: u16, body: Vec<u8>) -> Self
pub fn new(status: u16, body: Vec<u8>) -> Self
A reply with a status and a body.
These types are marked non exhaustive so fields can be added without breaking your
code, which also means you cannot build one with a struct literal. This is how you
build one, and it is what an implementation of HttpTransport needs.
Sourcepub fn with_retry_after(self, wait: Duration) -> Self
pub fn with_retry_after(self, wait: Duration) -> Self
Records what the server asked you to wait, from its Retry-After header.
Trait Implementations§
Source§impl Clone for HttpResponse
impl Clone for HttpResponse
Source§fn clone(&self) -> HttpResponse
fn clone(&self) -> HttpResponse
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 moreSource§impl Debug for HttpResponse
impl Debug for HttpResponse
impl Eq for HttpResponse
Source§impl PartialEq for HttpResponse
impl PartialEq for HttpResponse
impl StructuralPartialEq for HttpResponse
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnsafeUnpin for HttpResponse
impl UnwindSafe for HttpResponse
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