pub struct ProgressiveDownload<W: Write> { /* private fields */ }
Expand description
A persistent single download that can be used to track progress
Implementations§
Source§impl<W: Write> ProgressiveDownload<W>
impl<W: Write> ProgressiveDownload<W>
Sourcepub fn from_response(response: Response, writer: W) -> Self
pub fn from_response(response: Response, writer: W) -> Self
Create a new ProgressiveDownload from a response
Sourcepub fn get_downloaded(&self) -> usize
pub fn get_downloaded(&self) -> usize
Get the number of bytes that have been downloaded
Sourcepub fn get_total_length(&self) -> usize
pub fn get_total_length(&self) -> usize
Get the total length of the content
Sourcepub fn get_progress(&self) -> MessageContents
pub fn get_progress(&self) -> MessageContents
Get the progress message corresponding to this download
Sourcepub async fn poll_download(&mut self) -> Result<()>
pub async fn poll_download(&mut self) -> Result<()>
Poll the download
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Check if the download is finished
Source§impl ProgressiveDownload<Cursor<Vec<u8>>>
impl ProgressiveDownload<Cursor<Vec<u8>>>
Sourcepub async fn bytes(url: impl IntoUrl, client: &Client) -> Result<Self>
pub async fn bytes(url: impl IntoUrl, client: &Client) -> Result<Self>
Create a new ProgressiveDownload that downloads bytes
Sourcepub fn finish_json<D: DeserializeOwned>(self) -> Result<D>
pub fn finish_json<D: DeserializeOwned>(self) -> Result<D>
Consume the download into JSON
Auto Trait Implementations§
impl<W> Freeze for ProgressiveDownload<W>where
W: Freeze,
impl<W> !RefUnwindSafe for ProgressiveDownload<W>
impl<W> Send for ProgressiveDownload<W>where
W: Send,
impl<W> Sync for ProgressiveDownload<W>where
W: Sync,
impl<W> Unpin for ProgressiveDownload<W>where
W: Unpin,
impl<W> !UnwindSafe for ProgressiveDownload<W>
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