pub type ProgressCallback = Box<dyn Fn(ProgressInfo) + Send + 'static>;
Expand description
Type alias for a progress callback function used to report progress updates during long-running operations.
ProgressCallback
is a boxed function trait object that accepts a ProgressInfo
struct and is used to provide
real-time updates on the status of an ongoing operation. It allows monitoring progress, handling errors, or
executing additional actions based on the state of the process.
§Type
ProgressCallback
is defined as:
Box<dyn Fn(ProgressInfo) + Send + 'static>
ProgressInfo
: The struct containing details about the progress of the operation (current progress, total, message, callback type).Send
: Ensures that the callback can be safely transferred across thread boundaries.'static
: Indicates that the callback does not contain any non-static references, making it suitable for long-lived operations.
§Usage
This type is typically used in functions that perform asynchronous or lengthy tasks (like downloading or unpacking files) and need to provide progress feedback to the caller. The callback function can be customized to handle different types of progress updates.
Aliased Type§
pub struct ProgressCallback(/* private fields */);