docs: 添加 Rustdoc 注释

This commit is contained in:
2026-08-05 21:46:47 +08:00
parent 7c8f19f61a
commit 263fd255b6
158 changed files with 1440 additions and 15 deletions
+2
View File
@@ -1,9 +1,11 @@
use crate::bench::metrics::MetricCollection;
/// 把结果序列化为美观 JSON 字符串。
pub fn format_json(results: &[MetricCollection]) -> String {
serde_json::to_string_pretty(results).unwrap_or_else(|e| format!("{{\"error\": \"{}\"}}", e))
}
/// 把结果格式化为对齐的文本表格(供终端打印)。
pub fn format_text_table(results: &[MetricCollection]) -> String {
let mut out = String::new();
out.push_str(&format!(