11use crate :: diff:: { DifferenceReport , ReportItemDifference } ;
22
3+ /***
4+ *
5+ *
6+ *
7+ *
8+ * HEY
9+ *
10+ *
11+ *
12+ * THis whole file is hot garbage and I need to refactor it
13+ *
14+ * But we're just trying to get OK bot talking for now
15+ */
16+
317#[ derive( Debug ) ]
418pub struct DiffSummary {
519 pub unit_name : String ,
620 pub name : String ,
721 pub percent_difference : f32 ,
22+ pub size : u64 ,
823 pub size_difference : u64 ,
924}
1025
@@ -18,21 +33,32 @@ impl DiffSummary {
1833 Some ( demangled) => demangled. clone ( ) ,
1934 None => diff. name . clone ( ) ,
2035 } ,
36+ size : diff. size ,
2137 percent_difference : percent_diff,
22- size_difference : ( ( ( diff. size as f32 ) * percent_diff) as u64 / 4 ) ,
38+ size_difference : ( ( ( diff. size as f32 ) * ( percent_diff / 100.0 ) ) as u64 ) ,
2339 }
2440 }
2541
2642 pub fn to_string ( & self ) -> String {
2743 let direction = if self . percent_difference > 0.0 {
2844 "+"
2945 } else {
30- "foo"
46+ "-"
47+ } ;
48+ println ! ( "{:?}" , self ) ;
49+ let percent = format ! ( "{:.2}%" , self . percent_difference) ;
50+
51+ let emoji = match self . percent_difference {
52+ 100.00 => "✅" ,
53+ _ => match self . percent_difference > 0.0 {
54+ true => "📈" ,
55+ false => "📉" ,
56+ } ,
3157 } ;
3258
3359 format ! (
34- "{}: {} ({direction}{})" ,
35- self . name , self . percent_difference , self . size_difference
60+ "{emoji} `{}` - `{}`: {direction} {} ({direction}{})" ,
61+ self . unit_name , self . name , percent , self . size_difference
3662 )
3763 }
3864}
0 commit comments