pub struct TypedResponse<T> {
pub body: T,
pub status: StatusCode,
pub headers: HeaderMap,
}Expand description
A response with both the deserialized body and HTTP metadata.
Returned by Client::call_full and
RequestBuilder::send_full.
§Example
ⓘ
let resp = client.call_full::<GetUserEndpoint>((42u32,)).await?;
println!("status: {}", resp.status);
println!("user: {:?}", resp.body);
if let Some(etag) = resp.header("etag") {
println!("etag: {etag:?}");
}Fields§
§body: TThe deserialized response body.
status: StatusCodeThe HTTP status code.
headers: HeaderMapThe response headers.
Implementations§
Source§impl<T> TypedResponse<T>
impl<T> TypedResponse<T>
Sourcepub fn header(&self, name: &str) -> Option<&HeaderValue>
pub fn header(&self, name: &str) -> Option<&HeaderValue>
Get a specific header value by name.
Trait Implementations§
Source§impl<T: Clone> Clone for TypedResponse<T>
impl<T: Clone> Clone for TypedResponse<T>
Source§fn clone(&self) -> TypedResponse<T>
fn clone(&self) -> TypedResponse<T>
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 moreAuto Trait Implementations§
impl<T> Freeze for TypedResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for TypedResponse<T>where
T: RefUnwindSafe,
impl<T> Send for TypedResponse<T>where
T: Send,
impl<T> Sync for TypedResponse<T>where
T: Sync,
impl<T> Unpin for TypedResponse<T>where
T: Unpin,
impl<T> UnsafeUnpin for TypedResponse<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TypedResponse<T>where
T: UnwindSafe,
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