pub struct Response {
pub status_code: u16,
pub headers: HashMap<String, String>,
pub body: String,
}Expand description
Generic HTTP response returned by any transport implementation.
Fields§
§status_code: u16§headers: HashMap<String, String>§body: StringImplementations§
Source§impl Response
impl Response
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true if the response status is in the 2xx range.
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T>
pub fn json<T: DeserializeOwned>(&self) -> Result<T>
Deserializes the body as JSON.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Response
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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