Struct lazy_async_promise::Progress
source · pub struct Progress(_);Expand description
a f64 type which is constrained to the range of 0.0 and 1.0
Implementations§
source§impl Progress
impl Progress
sourcepub fn from_percent(percent: impl Into<f64>) -> Progress
pub fn from_percent(percent: impl Into<f64>) -> Progress
Create a Progress from a percentage
use lazy_async_promise::Progress;
let progress_half = Progress::from_percent(50);sourcepub fn from_fraction(
numerator: impl Into<f64>,
denominator: impl Into<f64>
) -> Progress
pub fn from_fraction(
numerator: impl Into<f64>,
denominator: impl Into<f64>
) -> Progress
Create a Progress from a fraction, useful for handling loops
use lazy_async_promise::Progress;
let num_iterations = 100;
for i in 0..num_iterations {
let progress_current = Progress::from_fraction(i, num_iterations);
}