MCPcopy Create free account
hub / github.com/c4pt0r/pie / human_bytes

Function human_bytes

crates/coding-agent/src/ui/mod.rs:2191–2201  ·  view source on GitHub ↗
(bytes: usize)

Source from the content-addressed store, hash-verified

2189}
2190
2191fn human_bytes(bytes: usize) -> String {
2192 const KIB: usize = 1024;
2193 const MIB: usize = 1024 * 1024;
2194 if bytes >= MIB {
2195 format!("{:.1} MiB", bytes as f64 / MIB as f64)
2196 } else if bytes >= KIB {
2197 format!("{:.1} KiB", bytes as f64 / KIB as f64)
2198 } else {
2199 format!("{bytes} B")
2200 }
2201}
2202
2203fn user_facing_run_error(error: &str) -> String {
2204 let Some(rest) = error.strip_prefix("no API key for provider: ") else {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected