Skip to main content

qubit_progress/reporter/format/
metric_snapshot_formatter.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2025 - 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10use crate::model::ProgressMetricSnapshot;
11
12/// Formats one progress metric snapshot into a string.
13///
14/// Formatter implementations decide whether the returned string is human
15/// readable text, JSON, line protocol, CSV, or another textual representation.
16pub trait MetricSnapshotFormatter: Send + Sync {
17    /// Formats a metric snapshot.
18    ///
19    /// # Parameters
20    ///
21    /// * `snapshot` - Metric snapshot to format.
22    ///
23    /// # Returns
24    ///
25    /// A formatted string for downstream consumers.
26    fn format(&self, snapshot: &ProgressMetricSnapshot) -> String;
27}