Skip to main content

entrenar/hf_pipeline/export/
result.rs

1//! Export result types.
2
3use std::path::PathBuf;
4
5use super::format::ExportFormat;
6
7/// Export result
8#[derive(Debug, Clone)]
9pub struct ExportResult {
10    /// Output path
11    pub path: PathBuf,
12    /// Format used
13    pub format: ExportFormat,
14    /// File size in bytes
15    pub size_bytes: u64,
16    /// Number of tensors exported
17    pub num_tensors: usize,
18}
19
20impl ExportResult {
21    /// Format size as human-readable string
22    #[must_use]
23    pub fn size_human(&self) -> String {
24        if self.size_bytes >= 1_000_000_000 {
25            format!("{:.2} GB", self.size_bytes as f64 / 1e9)
26        } else if self.size_bytes >= 1_000_000 {
27            format!("{:.2} MB", self.size_bytes as f64 / 1e6)
28        } else if self.size_bytes >= 1_000 {
29            format!("{:.2} KB", self.size_bytes as f64 / 1e3)
30        } else {
31            format!("{} B", self.size_bytes)
32        }
33    }
34}