pub struct ConditionalRequest {
pub last_modified: Option<SimpleDateTime>,
pub etag: Option<String>,
pub content_length: Option<u64>,
pub not_modified: bool,
}Expand description
Manages HTTP conditional headers for smart resume and unchanged-file detection.
Fields§
§last_modified: Option<SimpleDateTime>§etag: Option<String>§content_length: Option<u64>§not_modified: boolTrack whether server returned 304 Not Modified in last request
Implementations§
Source§impl ConditionalRequest
impl ConditionalRequest
Sourcepub fn to_headers(&self) -> Vec<(String, String)>
pub fn to_headers(&self) -> Vec<(String, String)>
Build headers for conditional request. If both Last-Modified and ETag present, prefer ETag (stronger validation).
Sourcepub fn update_from_response(
&mut self,
status: u16,
headers: &[(String, String)],
)
pub fn update_from_response( &mut self, status: u16, headers: &[(String, String)], )
Parse response headers to update state for next request.
Sourcepub fn should_skip(&self) -> bool
pub fn should_skip(&self) -> bool
Should we skip this download? (304 Not Modified)
Sourcepub fn can_resume(&self, local_file_size: u64) -> bool
pub fn can_resume(&self, local_file_size: u64) -> bool
Is resume possible? (have partial data + server supports Range)
Sourcepub fn needs_full_redownload(&self) -> bool
pub fn needs_full_redownload(&self) -> bool
Need full re-download? (416 or no range support detected)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConditionalRequest
impl RefUnwindSafe for ConditionalRequest
impl Send for ConditionalRequest
impl Sync for ConditionalRequest
impl Unpin for ConditionalRequest
impl UnsafeUnpin for ConditionalRequest
impl UnwindSafe for ConditionalRequest
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