From ee5b0886ec510b1c775a7664c58ca8070c2e8074 Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Thu, 2 Mar 2023 11:49:40 +0000 Subject: [PATCH] docs(http): add comment for duplicate struct info --- src/tracker/torrent.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/tracker/torrent.rs b/src/tracker/torrent.rs index aa155dfa..23ca6886 100644 --- a/src/tracker/torrent.rs +++ b/src/tracker/torrent.rs @@ -14,6 +14,8 @@ pub struct Entry { pub completed: u32, } +/// Swarm metadata dictionary in the scrape response. +/// BEP 48: #[derive(Debug, PartialEq, Default)] pub struct SwarmMetadata { pub complete: u32, // The number of active peers that have completed downloading (seeders) @@ -28,6 +30,14 @@ impl SwarmMetadata { } } +/// Swarm statistics. Alternative struct for swarm metadata in scrape response. +#[derive(Debug)] +pub struct SwamStats { + pub completed: u32, // The number of peers that have ever completed downloading + pub seeders: u32, // The number of active peers that have completed downloading (seeders) + pub leechers: u32, // The number of active peers that have not completed downloading (leechers) +} + impl Entry { #[must_use] pub fn new() -> Entry { @@ -111,13 +121,6 @@ impl Default for Entry { } } -#[derive(Debug)] -pub struct SwamStats { - pub completed: u32, - pub seeders: u32, - pub leechers: u32, -} - #[cfg(test)] mod tests {