pub struct AddTorrentParams {
pub source: AddSource,
pub category: Option<String>,
pub tags: Vec<String>,
pub download_dir: Option<PathBuf>,
pub paused: Option<bool>,
pub skip_checking: bool,
}Expand description
Unified parameters for SessionHandle::add_torrent (M170).
Replaces the ad-hoc set of add_magnet, add_magnet_uri,
add_torrent_bytes call shapes with a single params struct. Callers
build the struct via the static constructors (magnet or bytes)
and chain .with_category() / .with_tags() / .with_download_dir()
/ .paused().
Download-dir resolution (see add_torrent):
download_dir: Some(p)wins, if set.- Else, if
category: Some(name)and the registry containsname, the registry’ssave_pathis used. - Else, if
category: Some(name)and the registry does NOT containname, the call fails with [Error::CategoryNotFound]. - Else, falls back to
Settings.download_dir.
skip_checking is reserved for M171+ (qBt skip_hash_check=true).
Fields§
§source: AddSourceThe torrent source (magnet URI or raw .torrent bytes).
category: Option<String>Optional qBt-compat category label resolved via the session’s
CategoryRegistry at add-time.
M171: Per-torrent tags baked in at add time (qBt-compat). Multi- valued. An empty vec means “no tags” and is the default.
download_dir: Option<PathBuf>Explicit download directory, overrides both category lookup and
Settings.download_dir when Some.
paused: Option<bool>Whether the torrent should be added in a paused state. None (the
constructor default) means “use Settings::default_add_paused”;
Some(v) is an explicit per-call override. The resolution happens
in dispatch_add_torrent_m170 before the M170 post-add hooks run,
so the actor sees a concrete bool either way.
skip_checking: boolReserved for M171+ — skip the initial re-hash on add.
Implementations§
Source§impl AddTorrentParams
impl AddTorrentParams
Sourcepub fn with_category(self, name: impl Into<String>) -> Self
pub fn with_category(self, name: impl Into<String>) -> Self
Assign a category label to the torrent. The session resolves the name against its registry at add-time; unknown names error out.
M171: Attach tags at add time. Tags are baked into the torrent’s
config before TorrentActor::new, so the first stats() call
returns them — no post-add spawn race.
Sourcepub fn with_download_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn with_download_dir(self, dir: impl Into<PathBuf>) -> Self
Override the download directory for this torrent.
Sourcepub fn paused(self, paused: bool) -> Self
pub fn paused(self, paused: bool) -> Self
Toggle the paused-at-add flag. Wraps the explicit choice in Some(_)
so the actor can distinguish “caller explicitly set this” from
“caller did not touch it” (the latter falls back to
Settings::default_add_paused).
Sourcepub fn skip_checking(self, skip: bool) -> Self
pub fn skip_checking(self, skip: bool) -> Self
Toggle the skip-initial-check flag (M171+).
Trait Implementations§
Source§impl Clone for AddTorrentParams
impl Clone for AddTorrentParams
Source§fn clone(&self) -> AddTorrentParams
fn clone(&self) -> AddTorrentParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more