dw-rs 0.2.0

A blazingly fast, parallel download accelerator written in Rust.
Documentation
use std::time::Duration;

/// Tunables for the download engine.
///
/// Defaults are chosen to be fast and safe on a typical broadband link while
/// keeping peak memory bounded (roughly `2 * max_connections * write_buffer`).
#[derive(Clone, Debug)]
pub struct DownloadConfig {
    pub max_connections: usize,

    pub min_chunk_size: u64,
    
    pub piece_size: u64,

    pub write_buffer: usize,

    pub max_retries: u32,

    pub piece_timeout: Duration,

    pub connect_timeout: Duration,

    pub quiet: bool,
}

impl Default for DownloadConfig {
    fn default() -> Self {
        Self {
            max_connections: 8,
            min_chunk_size: 1024 * 1024,
            piece_size: 4 * 1024 * 1024,
            write_buffer: 4 * 1024 * 1024,
            max_retries: 5,
            piece_timeout: Duration::from_secs(60),
            connect_timeout: Duration::from_secs(15),
            quiet: false,
        }
    }
}