pub struct DownloadConfig {
pub url: String,
pub output_path: PathBuf,
pub checksum: Option<String>,
pub max_retries: u32,
pub timeout: Duration,
pub overwrite: bool,
}Expand description
Configuration for download operations
Fields§
§url: StringURL to download from
output_path: PathBufOutput file path
checksum: Option<String>Expected checksum (optional)
max_retries: u32Maximum number of retry attempts
timeout: DurationTimeout for the download operation
overwrite: boolWhether to overwrite existing files
Implementations§
Source§impl DownloadConfig
impl DownloadConfig
Sourcepub fn new(url: impl Into<String>, output_path: impl Into<PathBuf>) -> Self
pub fn new(url: impl Into<String>, output_path: impl Into<PathBuf>) -> Self
Create a new download configuration
Sourcepub fn with_checksum(self, checksum: impl Into<String>) -> Self
pub fn with_checksum(self, checksum: impl Into<String>) -> Self
Set the expected checksum
Sourcepub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
Set the maximum number of retries
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the timeout
Sourcepub fn with_overwrite(self, overwrite: bool) -> Self
pub fn with_overwrite(self, overwrite: bool) -> Self
Set whether to overwrite existing files
Trait Implementations§
Source§impl Clone for DownloadConfig
impl Clone for DownloadConfig
Source§fn clone(&self) -> DownloadConfig
fn clone(&self) -> DownloadConfig
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 DownloadConfig
impl RefUnwindSafe for DownloadConfig
impl Send for DownloadConfig
impl Sync for DownloadConfig
impl Unpin for DownloadConfig
impl UnwindSafe for DownloadConfig
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