MCPcopy Create free account
hub / github.com/ccusage/ccusage / track_usage_load

Function track_usage_load

rust/crates/ccusage/src/progress.rs:296–312  ·  view source on GitHub ↗
(
    agent: UsageLoadAgent,
    json: bool,
    load: impl FnOnce() -> std::result::Result<T, E>,
)

Source from the content-addressed store, hash-verified

294}
295
296pub(crate) fn track_usage_load<T, E>(
297 agent: UsageLoadAgent,
298 json: bool,
299 load: impl FnOnce() -> std::result::Result<T, E>,
300) -> std::result::Result<T, E> {
301 let enabled = crate::log_level() != Some(0)
302 && should_show_usage_load_progress(json, usage_load_output_is_tty());
303 let mut progress = UsageLoadProgress::new(enabled);
304 progress.start(agent);
305 let result = load();
306 match &result {
307 Ok(_) => progress.succeed(agent),
308 Err(_) => progress.fail(agent),
309 }
310 progress.stop();
311 result
312}
313
314pub(crate) fn track_status<T>(
315 enabled: bool,

Callers 15

load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_entriesFunction · 0.85
load_codex_eventsFunction · 0.85

Calls 7

log_levelFunction · 0.85
usage_load_output_is_ttyFunction · 0.85
startMethod · 0.80
succeedMethod · 0.80
failMethod · 0.80
stopMethod · 0.80

Tested by

no test coverage detected