#[derive(Debug, Clone, PartialEq)]
pub struct ProgressStage {
id: String,
name: String,
index: Option<usize>,
total_stages: Option<usize>,
weight: Option<f64>,
}
impl ProgressStage {
#[inline]
pub fn new(id: &str, name: &str) -> Self {
Self {
id: id.to_owned(),
name: name.to_owned(),
index: None,
total_stages: None,
weight: None,
}
}
#[inline]
pub const fn with_index(mut self, index: usize) -> Self {
self.index = Some(index);
self
}
#[inline]
pub const fn with_total_stages(mut self, total_stages: usize) -> Self {
self.total_stages = Some(total_stages);
self
}
#[inline]
pub const fn with_weight(mut self, weight: f64) -> Self {
self.weight = Some(weight);
self
}
#[inline]
pub fn id(&self) -> &str {
self.id.as_str()
}
#[inline]
pub fn name(&self) -> &str {
self.name.as_str()
}
#[inline]
pub const fn index(&self) -> Option<usize> {
self.index
}
#[inline]
pub const fn total_stages(&self) -> Option<usize> {
self.total_stages
}
#[inline]
pub const fn weight(&self) -> Option<f64> {
self.weight
}
}