pub type SharedProgressCallback = Arc<dyn Fn(MameDataType, ProgressInfo) + Send + Sync + 'static>;
Expand description
Type alias for a shared progress callback function used to report progress updates across multiple threads.
SharedProgressCallback
is a thread-safe, reference-counted function trait object that accepts a MameDataType
and a ProgressInfo
struct. It is designed to provide real-time updates on the status of an ongoing operation
from multiple threads, allowing concurrent tasks to share a single callback for progress reporting.
§Type
SharedProgressCallback
is defined as:
Arc<dyn Fn(MameDataType, ProgressInfo) + Send + Sync + 'static>
MameDataType
: An enum indicating the type of MAME data being processed (e.g., ROMs, DAT files).ProgressInfo
: A 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.Sync
: Ensures that the callback can be safely shared and called from multiple threads simultaneously.'static
: Indicates that the callback does not contain any non-static references, making it suitable for long-lived and shared operations.
§Usage
This type is typically used in scenarios where multiple threads perform concurrent tasks (like unpacking or downloading files),
and a single, shared callback is needed to handle progress updates. The Arc
wrapper allows multiple ownership of the callback,
ensuring it remains valid and accessible across all threads involved in the operation.
Aliased Type§
pub struct SharedProgressCallback { /* private fields */ }