pub struct BtProgress {
pub info_hash: [u8; 20],
pub bitfield: Vec<u8>,
pub peers: Vec<PeerAddr>,
pub stats: DownloadStats,
pub piece_length: u32,
pub total_size: u64,
pub num_pieces: u32,
pub save_time: SystemTime,
pub version: u32,
}Expand description
BT download progress data structure
Contains all state information for BT download, used for persisting to disk.
Fields§
§info_hash: [u8; 20]Torrent info_hash
bitfield: Vec<u8>Downloaded piece bitmap
peers: Vec<PeerAddr>Connected peer list
stats: DownloadStatsDownload statistics
piece_length: u32Length of each piece
total_size: u64Total size
num_pieces: u32Total number of pieces
save_time: SystemTimeSave time
version: u32Format version number
Implementations§
Source§impl BtProgress
impl BtProgress
Sourcepub fn to_hex_hash(&self) -> String
pub fn to_hex_hash(&self) -> String
Sourcepub fn completion_ratio(&self) -> f64
pub fn completion_ratio(&self) -> f64
Calculate completion percentage
Calculates download completion ratio based on bits set in bitfield.
§Returns
Returns completion ratio between 0.0 and 1.0
Trait Implementations§
Source§impl Clone for BtProgress
impl Clone for BtProgress
Source§fn clone(&self) -> BtProgress
fn clone(&self) -> BtProgress
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BtProgress
impl Debug for BtProgress
Auto Trait Implementations§
impl Freeze for BtProgress
impl RefUnwindSafe for BtProgress
impl Send for BtProgress
impl Sync for BtProgress
impl Unpin for BtProgress
impl UnsafeUnpin for BtProgress
impl UnwindSafe for BtProgress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more