pub struct CachedResponse { /* private fields */ }Expand description
A response wrapper that can represent both cached and fresh responses
Implementations§
Source§impl CachedResponse
impl CachedResponse
Sourcepub fn headers_names(&self) -> impl Iterator<Item = &String>
pub fn headers_names(&self) -> impl Iterator<Item = &String>
Get all header names
Sourcepub fn into_string(self) -> Result<String, HttpCacheError>
pub fn into_string(self) -> Result<String, HttpCacheError>
Convert the response body to a string
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Convert to bytes, consuming the response
Sourcepub fn into_json<T: DeserializeOwned>(self) -> Result<T, HttpCacheError>
Available on crate feature json only.
pub fn into_json<T: DeserializeOwned>(self) -> Result<T, HttpCacheError>
json only.Parse response body as JSON
Trait Implementations§
Source§impl Debug for CachedResponse
impl Debug for CachedResponse
Source§impl From<HttpResponse> for CachedResponse
impl From<HttpResponse> for CachedResponse
Source§fn from(response: HttpResponse) -> Self
fn from(response: HttpResponse) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CachedResponse
impl RefUnwindSafe for CachedResponse
impl Send for CachedResponse
impl Sync for CachedResponse
impl Unpin for CachedResponse
impl UnwindSafe for CachedResponse
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more