pub struct RequestBuilder { /* private fields */ }Expand description
Builder for a single download request.
Implementations§
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add an HTTP header.
Sourcepub fn preferred_downloader(self, preferred: Downloader) -> Self
pub fn preferred_downloader(self, preferred: Downloader) -> Self
Prefer a specific downloader backend.
Sourcepub fn follow_redirects(self, follow_redirects: bool) -> Self
pub fn follow_redirects(self, follow_redirects: bool) -> Self
Enable or disable HTTP redirect following.
Sourcepub fn fetch_string(self) -> Result<String, ResponseError>
pub fn fetch_string(self) -> Result<String, ResponseError>
Fetch the response body as a String, blocking until the download is complete.
Sourcepub fn fetch_bytes(self) -> Result<Vec<u8>, ResponseError>
pub fn fetch_bytes(self) -> Result<Vec<u8>, ResponseError>
Fetch the response body into memory, blocking until the download is complete.
Sourcepub fn start(
self,
target_path: impl AsRef<Path>,
) -> Result<RequestHandle, StartError>
pub fn start( self, target_path: impl AsRef<Path>, ) -> Result<RequestHandle, StartError>
Start the download in a background thread.
Trait Implementations§
Source§impl Clone for RequestBuilder
impl Clone for RequestBuilder
Source§fn clone(&self) -> RequestBuilder
fn clone(&self) -> RequestBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 RequestBuilder
impl RefUnwindSafe for RequestBuilder
impl Send for RequestBuilder
impl Sync for RequestBuilder
impl Unpin for RequestBuilder
impl UnsafeUnpin for RequestBuilder
impl UnwindSafe for RequestBuilder
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