Skip to main content

DownloadOptions

Struct DownloadOptions 

Source
pub struct DownloadOptions {
Show 39 fields pub split: Option<u16>, pub max_connection_per_server: Option<u16>, pub max_download_limit: Option<u64>, pub max_upload_limit: Option<u64>, pub dir: Option<String>, pub out: Option<String>, pub file_allocation: Option<String>, pub mmap_threshold: Option<u64>, pub secure_falloc: bool, pub seed_time: Option<u64>, pub seed_ratio: Option<f64>, pub checksum: Option<(String, String)>, pub cookie_file: Option<String>, pub cookies: Option<String>, pub bt_force_encrypt: bool, pub bt_require_crypto: bool, pub enable_dht: bool, pub dht_listen_port: Option<u16>, pub dht_entry_point: Option<Vec<String>>, pub enable_public_trackers: bool, pub bt_piece_selection_strategy: String, pub bt_endgame_threshold: u32, pub max_retries: u32, pub retry_wait: u64, pub http_proxy: Option<String>, pub all_proxy: Option<String>, pub https_proxy: Option<String>, pub ftp_proxy: Option<String>, pub no_proxy: Option<String>, pub dht_file_path: Option<String>, pub bt_max_upload_slots: Option<u32>, pub bt_optimistic_unchoke_interval: Option<u64>, pub bt_snubbed_timeout: Option<u64>, pub bt_prioritize_piece: String, pub enable_utp: bool, pub utp_listen_port: Option<u16>, pub header: Vec<String>, pub user_agent: Option<String>, pub referer: Option<String>,
}

Fields§

§split: Option<u16>§max_connection_per_server: Option<u16>§max_download_limit: Option<u64>§max_upload_limit: Option<u64>§dir: Option<String>§out: Option<String>§file_allocation: Option<String>

File allocation strategy: “none”, “prealloc”, “falloc”, “trunc”, or “mmap”. When “mmap”, MmapDiskWriter is used for files above mmap_threshold.

§mmap_threshold: Option<u64>

File size threshold (bytes) above which mmap writes are used when file_allocation = "mmap". Default: 256 MiB.

§secure_falloc: bool

Zero-fill allocated blocks after fallocate on platforms that don’t zero-fill (macOS F_PREALLOCATE, Windows SetFileValidData). Prevents exposure of residual disk data at a performance cost. Has no effect on Linux. Defaults to false (matches constants::DEFAULT_SECURE_FALLOC).

§seed_time: Option<u64>§seed_ratio: Option<f64>§checksum: Option<(String, String)>§cookie_file: Option<String>§cookies: Option<String>§bt_force_encrypt: bool§bt_require_crypto: bool§enable_dht: bool§dht_listen_port: Option<u16>§dht_entry_point: Option<Vec<String>>§enable_public_trackers: bool§bt_piece_selection_strategy: String§bt_endgame_threshold: u32§max_retries: u32§retry_wait: u64§http_proxy: Option<String>§all_proxy: Option<String>§https_proxy: Option<String>§ftp_proxy: Option<String>§no_proxy: Option<String>§dht_file_path: Option<String>§bt_max_upload_slots: Option<u32>

Maximum number of peers to unchoke simultaneously during seeding. Default: 4. Set to enable the choking algorithm.

§bt_optimistic_unchoke_interval: Option<u64>

Interval in seconds between optimistic unchokes. Default: 30.

§bt_snubbed_timeout: Option<u64>

Timeout in seconds after which a peer is considered snubbed (not sending data). Default: 60.

§bt_prioritize_piece: String

Piece selection priority: “rarest” (default), “head” (sequential from start), “tail” (sequential from end).

§enable_utp: bool

Enable uTP (UDP Transport Protocol) for BitTorrent connections. This implements BEP 29 and is an experimental feature not in original aria2. Default: false.

§utp_listen_port: Option<u16>

UDP port for uTP connections. 0 = auto-assign. Experimental feature not in original aria2.

§header: Vec<String>

Custom HTTP request headers as "Name: Value" strings. Applied to both HEAD probes and range GETs.

§user_agent: Option<String>

Override User-Agent header. Also injected into the header list by DownloadOptions::parsed_headers when set.

§referer: Option<String>

Override Referer header. Also injected into the header list by DownloadOptions::parsed_headers when set.

Implementations§

Source§

impl DownloadOptions

Source

pub fn parsed_headers(&self) -> Vec<(String, String)>

Parse the raw header list into (name, value) pairs, splitting each "Name: Value" entry on the first :. When user_agent or referer are set, they are appended as User-Agent / Referer pairs (unless an entry with the same name already exists), so callers only need to handle a single header list.

Trait Implementations§

Source§

impl Clone for DownloadOptions

Source§

fn clone(&self) -> DownloadOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DownloadOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DownloadOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more