pub struct Report {
pub original_size: usize,
pub transformed_size: usize,
pub images_found: usize,
pub images_modified: usize,
pub images_dropped: usize,
pub svgs_rasterized: usize,
pub actions: Vec<ActionRecord>,
pub warnings: Vec<String>,
pub dry_run: bool,
pub image_metrics: Vec<ImageMetrics>,
pub token_savings: TokenSavings,
}Expand description
Report of all transformations applied by SHIFT.
Fields§
§original_size: usizeTotal payload size before transformation (bytes)
transformed_size: usizeTotal payload size after transformation (bytes)
images_found: usizeNumber of images found in the payload
images_modified: usizeNumber of images that were modified
images_dropped: usizeNumber of images dropped
svgs_rasterized: usizeNumber of SVGs rasterized
actions: Vec<ActionRecord>Individual action records
warnings: Vec<String>Warnings (non-fatal issues)
dry_run: boolWhether this was a dry run (no actual changes)
image_metrics: Vec<ImageMetrics>Per-image before/after metrics (dimensions, bytes, tokens)
token_savings: TokenSavingsAggregate token savings across all images
Implementations§
Source§impl Report
impl Report
pub fn new() -> Self
pub fn add_action(&mut self, image_index: usize, action: &str, detail: &str)
pub fn add_warning(&mut self, warning: &str)
pub fn add_image_metrics(&mut self, metrics: ImageMetrics)
Sourcepub fn finalize_token_savings(&mut self)
pub fn finalize_token_savings(&mut self)
Recompute aggregate token savings from per-image metrics.
Sourcepub fn size_reduction_pct(&self) -> f64
pub fn size_reduction_pct(&self) -> f64
Size change as a percentage.
Positive values indicate reduction (smaller output). Negative values indicate the output grew (e.g., format conversion).
Sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Whether any transformations were actually applied.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Report
impl<'de> Deserialize<'de> for Report
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Report
impl RefUnwindSafe for Report
impl Send for Report
impl Sync for Report
impl Unpin for Report
impl UnsafeUnpin for Report
impl UnwindSafe for Report
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more