Skip to main content

FastResumeData

Struct FastResumeData 

Source
pub struct FastResumeData {
Show 42 fields pub file_format: String, pub file_version: i64, pub info_hash: Vec<u8>, pub name: String, pub save_path: String, pub pieces: Vec<u8>, pub unfinished: Vec<UnfinishedPiece>, pub total_uploaded: i64, pub total_downloaded: i64, pub active_time: i64, pub seeding_time: i64, pub finished_time: i64, pub added_time: i64, pub completed_time: i64, pub last_download: i64, pub last_upload: i64, pub paused: i64, pub queued: i64, pub auto_managed: i64, pub queue_position: i64, pub sequential_download: i64, pub seed_mode: i64, pub trackers: Vec<Vec<String>>, pub peers: Vec<u8>, pub peers6: Vec<u8>, pub file_priority: Vec<i64>, pub piece_priority: Vec<i64>, pub upload_rate_limit: i64, pub download_rate_limit: i64, pub max_connections: i64, pub max_uploads: i64, pub info: Option<Vec<u8>>, pub super_seeding: i64, pub url_seeds: Vec<String>, pub http_seeds: Vec<String>, pub info_hash2: Option<Vec<u8>>, pub trees: HashMap<String, Vec<u8>>, pub category: Option<String>, pub created_by: Option<String>, pub creation_date: Option<i64>, pub tags: Vec<String>, pub web_seed_stats: HashMap<String, WebSeedStats>,
}
Expand description

libtorrent-compatible fast-resume data in bencode format.

This struct matches libtorrent’s resume file format so that resume data can be read/written by both Torrent and libtorrent-based clients. Every field uses #[serde(rename = "...")] to match libtorrent’s exact bencode dictionary keys.

Fields§

§file_format: String

Always “libtorrent resume file”.

§file_version: i64

Always 1.

§info_hash: Vec<u8>

20-byte SHA1 info hash.

§name: String

Torrent name.

§save_path: String

Path where files are saved.

§pieces: Vec<u8>

Bitfield indicating which pieces are complete.

§unfinished: Vec<UnfinishedPiece>

Partially downloaded pieces.

§total_uploaded: i64

Total bytes uploaded.

§total_downloaded: i64

Total bytes downloaded.

§active_time: i64

Total time active in seconds.

§seeding_time: i64

Total time spent seeding in seconds.

§finished_time: i64

Total time in finished state in seconds.

§added_time: i64

POSIX timestamp when the torrent was added.

§completed_time: i64

POSIX timestamp when the torrent completed.

§last_download: i64

POSIX timestamp of last download activity.

§last_upload: i64

POSIX timestamp of last upload activity.

§paused: i64

Whether the torrent is paused (0 or 1).

§queued: i64

Whether the torrent is queued by auto-manage (0 or 1).

§auto_managed: i64

Whether the torrent is auto-managed.

§queue_position: i64

Queue position (-1 = not queued).

§sequential_download: i64

Whether sequential download is enabled.

§seed_mode: i64

Whether seed mode is enabled.

§trackers: Vec<Vec<String>>

Tracker tiers (list of lists of tracker URLs).

§peers: Vec<u8>

Compact IPv4 peers (6 bytes each: 4 IP + 2 port).

§peers6: Vec<u8>

Compact IPv6 peers (18 bytes each: 16 IP + 2 port).

§file_priority: Vec<i64>

Per-file priority values.

§piece_priority: Vec<i64>

Per-piece priority values.

§upload_rate_limit: i64

Upload rate limit in bytes/sec (-1 = unlimited).

§download_rate_limit: i64

Download rate limit in bytes/sec (-1 = unlimited).

§max_connections: i64

Max connections for this torrent (-1 = unlimited).

§max_uploads: i64

Max upload slots for this torrent (-1 = unlimited).

§info: Option<Vec<u8>>

Raw bencoded info dictionary (for magnet links that have resolved).

§super_seeding: i64

BEP 16: whether super seeding was enabled.

§url_seeds: Vec<String>

BEP 19 web seed URLs (GetRight-style).

§http_seeds: Vec<String>

BEP 17 HTTP seed URLs (Hoffman-style).

§info_hash2: Option<Vec<u8>>

SHA-256 v2 info hash (32 bytes, BEP 52).

§trees: HashMap<String, Vec<u8>>

Cached piece-layer Merkle hashes per file. Key: hex-encoded file root hash. Value: concatenated 32-byte piece hashes. Allows skipping piece-layer hash requests on resume.

§category: Option<String>

User-assigned category label (qBt-compat). None = uncategorised.

§created_by: Option<String>

Torrent creator string from TorrentMetaV1.created_by. None if the torrent was added via magnet before metadata resolved.

§creation_date: Option<i64>

UNIX timestamp (seconds) when the torrent was authored, from TorrentMetaV1.creation_date. None if not present in the .torrent file or if metadata has not yet resolved for a magnet-added torrent.

§tags: Vec<String>

User-assigned tags (qBt-compat). Multi-valued per torrent. Empty vec when no tags set; skip_serializing_if = "Vec::is_empty" keeps older resume files (which have no tags key) bit-identical on save.

§web_seed_stats: HashMap<String, WebSeedStats>

Per-URL web-seed stats (BEP 17/19), keyed by URL. Empty map when no stats accumulated; skip_serializing_if keeps older resume files (which have no web_seed_stats key) bit-identical on save. Backward-compat: #[serde(default)] means legacy resume files load with an empty map.

Implementations§

Source§

impl FastResumeData

Source

pub fn new(info_hash: Vec<u8>, name: String, save_path: String) -> Self

Create a new FastResumeData with format markers pre-filled and all other fields zeroed/empty. Rate limits default to -1 (unlimited).

Trait Implementations§

Source§

impl Clone for FastResumeData

Source§

fn clone(&self) -> FastResumeData

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 FastResumeData

Source§

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

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

impl<'de> Deserialize<'de> for FastResumeData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for FastResumeData

Source§

fn eq(&self, other: &FastResumeData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for FastResumeData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FastResumeData

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, 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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,