pub struct BatchBuilder { /* private fields */ }Expand description
Builder for downloading multiple URLs concurrently.
Create one via crate::batch().
Implementations§
Source§impl BatchBuilder
impl BatchBuilder
Sourcepub fn new(urls: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn new(urls: impl IntoIterator<Item = impl Into<String>>) -> Self
Create a batch builder from any iterator of URL strings.
Sourcepub fn concurrency(self, n: usize) -> Self
pub fn concurrency(self, n: usize) -> Self
Maximum number of simultaneous downloads. Default: 4.
Sourcepub fn output_dir(self, dir: impl Into<String>) -> Self
pub fn output_dir(self, dir: impl Into<String>) -> Self
Directory where all files are saved. Default: current directory.
Sourcepub fn speed_limit(self, bps: u64) -> Self
pub fn speed_limit(self, bps: u64) -> Self
Speed limit applied to each individual download (bytes/s).
Sourcepub fn proxy_auth(
self,
user: impl Into<String>,
pass: impl Into<String>,
) -> Self
pub fn proxy_auth( self, user: impl Into<String>, pass: impl Into<String>, ) -> Self
Proxy credentials.
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add a custom HTTP header sent with every download.
Sourcepub fn retry(self, config: RetryConfig) -> Self
pub fn retry(self, config: RetryConfig) -> Self
Retry policy for each individual download.
Sourcepub fn download_all(self) -> Vec<BatchResult>
pub fn download_all(self) -> Vec<BatchResult>
Run all downloads with bounded concurrency and return one result per URL.
Uses a Rayon thread pool sized to concurrency.
Auto Trait Implementations§
impl Freeze for BatchBuilder
impl RefUnwindSafe for BatchBuilder
impl Send for BatchBuilder
impl Sync for BatchBuilder
impl Unpin for BatchBuilder
impl UnsafeUnpin for BatchBuilder
impl UnwindSafe for BatchBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more