pub struct CachedResponse {
pub body: Arc<Vec<u8>>,
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 is wrapped in Arc for
zero-cost cloning across multiple consumers.
§Examples
use deps_core::cache::CachedResponse;
use std::sync::Arc;
use std::time::Instant;
let response = CachedResponse {
body: Arc::new(b"response data".to_vec()),
etag: Some("\"abc123\"".into()),
last_modified: None,
fetched_at: Instant::now(),
};
// Clone is cheap - only increments Arc reference count
let cloned = response.clone();
assert!(Arc::ptr_eq(&response.body, &cloned.body));Fields§
§body: Arc<Vec<u8>>§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