#[non_exhaustive]pub struct FetchResponse {
pub status: u16,
pub status_text: String,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Expand description
Response from route.fetch(), allowing inspection and modification before fulfillment.
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: u16HTTP status code
status_text: StringHTTP status text
headers: Vec<(String, String)>Response headers as name-value pairs
body: Vec<u8>Response body as bytes
Implementations§
Source§impl FetchResponse
impl FetchResponse
Sourcepub fn status_text(&self) -> &str
pub fn status_text(&self) -> &str
Returns the status text
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T>
pub fn json<T: DeserializeOwned>(&self) -> Result<T>
Returns the response body parsed as JSON
Trait Implementations§
Source§impl Clone for FetchResponse
impl Clone for FetchResponse
Source§fn clone(&self) -> FetchResponse
fn clone(&self) -> FetchResponse
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 moreAuto Trait Implementations§
impl Freeze for FetchResponse
impl RefUnwindSafe for FetchResponse
impl Send for FetchResponse
impl Sync for FetchResponse
impl Unpin for FetchResponse
impl UnsafeUnpin for FetchResponse
impl UnwindSafe for FetchResponse
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