MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / format_byte_count

Function format_byte_count

atomic-cli/src/commands/git/parallel.rs:2847–2862  ·  view source on GitHub ↗
(bytes: usize)

Source from the content-addressed store, hash-verified

2845}
2846
2847fn format_byte_count(bytes: usize) -> String {
2848 const KIB: f64 = 1024.0;
2849 const MIB: f64 = KIB * 1024.0;
2850 const GIB: f64 = MIB * 1024.0;
2851
2852 let bytes_f = bytes as f64;
2853 if bytes_f >= GIB {
2854 format!("{:.1}GiB", bytes_f / GIB)
2855 } else if bytes_f >= MIB {
2856 format!("{:.1}MiB", bytes_f / MIB)
2857 } else if bytes_f >= KIB {
2858 format!("{:.1}KiB", bytes_f / KIB)
2859 } else {
2860 format!("{}B", bytes)
2861 }
2862}
2863
2864fn should_detect_renames(diff: &Diff) -> bool {
2865 let mut adds = 0usize;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected