pub struct Downloader { /* private fields */ }Implementations§
Source§impl Downloader
impl Downloader
pub fn new<S: Into<String>>(url: S) -> Self
Sourcepub async fn download(
&mut self,
path: &str,
filename: Option<String>,
threads: Option<u8>,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn download( &mut self, path: &str, filename: Option<String>, threads: Option<u8>, ) -> Result<(), Box<dyn Error + Send + Sync>>
downloads the file into the provided path
§Arguments
path: download paththreads: number of threads to use for downloading. if you pass None, or Some(0), it will defaults to 8
Note: If the download size is less than 1 MB, then it will completely ignore threads, and download it as a single thread.
If the file size is unknown at the moment it gets the header, it will also ignore threads and skips the progress bar and just shows a simple ticker as a feedback to let user know that the process is not is in a deadlock state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Downloader
impl !RefUnwindSafe for Downloader
impl Send for Downloader
impl Sync for Downloader
impl Unpin for Downloader
impl UnsafeUnpin for Downloader
impl !UnwindSafe for Downloader
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