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

Function json_value_u64

rust/crates/ccusage/src/utils.rs:5–7  ·  view source on GitHub ↗
(value: Option<&Value>)

Source from the content-addressed store, hash-verified

3use crate::TokenUsageRaw;
4
5pub(crate) fn json_value_u64(value: Option<&Value>) -> u64 {
6 value.and_then(Value::as_u64).unwrap_or_default()
7}
8
9pub(crate) fn non_empty_json_string(value: Option<&Value>) -> Option<String> {
10 let value = value?.as_str()?.trim();

Callers 5

parse_token_usageFunction · 0.85
parse_ledger_eventsFunction · 0.85
parse_message_usageFunction · 0.85
print_table_for_agentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected