pub struct Progress {
pub id: String,
pub current: u64,
pub total: Option<u64>,
pub description: Option<String>,
pub status: ProgressStatus,
pub updated_at: u64,
pub metadata: HashMap<String, Value>,
}Expand description
Progress information for long-running operations
Fields§
§id: StringUnique identifier for this progress
current: u64Current progress value
total: Option<u64>Total expected value (if known)
description: Option<String>Human-readable description
status: ProgressStatusCurrent status
updated_at: u64Timestamp of last update (Unix timestamp)
metadata: HashMap<String, Value>Additional metadata
Implementations§
Source§impl Progress
impl Progress
Sourcepub fn with_total(self, total: u64) -> Progress
pub fn with_total(self, total: u64) -> Progress
Set the total expected value
Sourcepub fn with_description(self, description: impl Into<String>) -> Progress
pub fn with_description(self, description: impl Into<String>) -> Progress
Set the description
Sourcepub fn with_current(self, current: u64) -> Progress
pub fn with_current(self, current: u64) -> Progress
Set the current progress
Sourcepub fn with_status(self, status: ProgressStatus) -> Progress
pub fn with_status(self, status: ProgressStatus) -> Progress
Set the status
Sourcepub fn update_with_description(
&mut self,
current: u64,
description: impl Into<String>,
)
pub fn update_with_description( &mut self, current: u64, description: impl Into<String>, )
Update with description
Sourcepub fn percentage(&self) -> Option<f64>
pub fn percentage(&self) -> Option<f64>
Get progress percentage (0-100) if total is known
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Check if the operation is finished
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Progress
impl<'de> Deserialize<'de> for Progress
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Progress, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Progress, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Progress> for ProgressNotification
impl From<Progress> for ProgressNotification
Source§fn from(progress: Progress) -> ProgressNotification
fn from(progress: Progress) -> ProgressNotification
Converts to this type from the input type.
Source§impl Serialize for Progress
impl Serialize for Progress
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Progress
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnsafeUnpin for Progress
impl UnwindSafe for Progress
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