Skip to main content

AsyncWriterFactory

Trait AsyncWriterFactory 

Source
pub trait AsyncWriterFactory {
    // Required method
    fn get_writer<'a, 'async_trait>(
        &'a mut self,
        content_length: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn AsyncWrite + Unpin + 'a>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
}
Expand description

An AsyncWriterFactory can produce, on demand, an AsyncWrite object. In the event of a download failure, the restarted download will use a fresh writer to restart writing at the beginning.

Required Methods§

Source

fn get_writer<'a, 'async_trait>( &'a mut self, content_length: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn AsyncWrite + Unpin + 'a>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Get a fresh AsyncWrite object, positioned at the point where downloaded data should be written.

The content_length parameter holds the response’s Content-Length if it’s known (see content_length). It’s only a hint intended for sizing the writer, and must not be relied upon. It might be None for chunked or decompressed responses, and for a compressed body it reflects the compressed size, so the number of bytes actually written may differ.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§