pub fn budget_tokens(content: &str) -> u32Expand description
The canonical budget-token cost of a piece of frame content.
This is the value ContextFrame::token_cost MUST carry (SPEC.md §B3).
Exact equality is required — there is no tolerance band, because any band
wide enough to absorb genuine tokenizer disagreement is also wide enough to
hide meaningful under-reporting, which puts the suite back to guessing. A
provider cannot “disagree” with a byte count.
use contextgraph_types::budget_tokens;
assert_eq!(budget_tokens(""), 0);
assert_eq!(budget_tokens("abcd"), 1);
assert_eq!(budget_tokens("abcde"), 2); // ceil, never floor