pub struct SeedExitCondition {
pub seed_time: Option<Duration>,
pub seed_ratio: Option<f64>,
}Fields§
§seed_time: Option<Duration>§seed_ratio: Option<f64>Implementations§
Source§impl SeedExitCondition
impl SeedExitCondition
pub fn infinite() -> Self
pub fn with_time(secs: u64) -> Self
pub fn with_ratio(ratio: f64) -> Self
pub fn with_time_and_ratio(secs: u64, ratio: f64) -> Self
Sourcepub fn check_seed_condition(
uploaded: u64,
downloaded: u64,
seed_ratio: f64,
) -> bool
pub fn check_seed_condition( uploaded: u64, downloaded: u64, seed_ratio: f64, ) -> bool
Check if the seed ratio condition has been met.
Returns true when seeding should stop based on upload/download ratio:
- If
seed_ratio <= 0.0, returnsfalse(infinite seeding) - If
downloaded == 0, returnsfalse(nothing downloaded yet) - Otherwise, checks if
uploaded / downloaded >= seed_ratio
§Arguments
uploaded- Total bytes uploaded during this sessiondownloaded- Total bytes downloaded during this sessionseed_ratio- Target ratio (e.g., 1.0 means 1:1 upload:download)
Sourcepub fn check_seed_time(
seeding_started_at: Instant,
seed_time_secs: u64,
is_pure_seeding: bool,
) -> bool
pub fn check_seed_time( seeding_started_at: Instant, seed_time_secs: u64, is_pure_seeding: bool, ) -> bool
Check if the seed time condition has been met.
Returns true when pure seeding duration exceeds the limit:
- If
seed_time_secs == 0, returnsfalse(infinite seeding) - If not in pure seeding phase (
is_pure_seeding == false), returnsfalse - Otherwise, checks if elapsed seconds since
seeding_started_at >= seed_time_secs
§Arguments
seeding_started_at- Instant when pure seeding phase beganseed_time_secs- Maximum allowed seeding duration in seconds (0 = infinite)is_pure_seeding- Whether all pieces are complete (true = in seeding phase)
Trait Implementations§
Source§impl Clone for SeedExitCondition
impl Clone for SeedExitCondition
Source§fn clone(&self) -> SeedExitCondition
fn clone(&self) -> SeedExitCondition
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 SeedExitCondition
impl Debug for SeedExitCondition
Source§impl Default for SeedExitCondition
impl Default for SeedExitCondition
Source§fn default() -> SeedExitCondition
fn default() -> SeedExitCondition
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SeedExitCondition
impl RefUnwindSafe for SeedExitCondition
impl Send for SeedExitCondition
impl Sync for SeedExitCondition
impl Unpin for SeedExitCondition
impl UnsafeUnpin for SeedExitCondition
impl UnwindSafe for SeedExitCondition
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