pub struct CachedResponse {
pub body: Bytes,
pub etag: Option<String>,
pub last_modified: Option<String>,
pub fetched_at: Instant,
}Expand description
Cached HTTP response with validation headers.
Stores response body and cache validation headers (ETag, Last-Modified)
for efficient conditional requests. The body uses Bytes which is an
Arc-like type optimized for network data, enabling zero-cost cloning
across multiple consumers without copying.
§Examples
use deps_core::cache::CachedResponse;
use bytes::Bytes;
use std::time::Instant;
let response = CachedResponse {
body: Bytes::from("response data"),
etag: Some("\"abc123\"".into()),
last_modified: None,
fetched_at: Instant::now(),
};
// Clone is cheap - only increments reference count
let cloned = response.clone();Fields§
§body: Bytes§etag: Option<String>§last_modified: Option<String>§fetched_at: InstantTrait Implementations§
Source§impl Clone for CachedResponse
impl Clone for CachedResponse
Source§fn clone(&self) -> CachedResponse
fn clone(&self) -> CachedResponse
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 !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