pub struct Usage {
pub schema_version: u32,
pub period: String,
pub created_at: String,
pub agent_id: String,
pub metered_events: usize,
pub net_saved_tokens: u64,
pub saved_usd: f64,
pub last_entry_hash: String,
pub chain_valid: bool,
pub signed: bool,
}Expand description
A billable usage record for a metering period. Carries only counts, sums,
and provenance hashes — no paths, prompts, or content (inherited from
RoiReport’s privacy guarantee).
Fields§
§schema_version: u32Schema version of the metering record.
period: StringCoverage window ("all" today).
created_at: StringWhen the record was produced.
agent_id: StringThe agent/machine identity the ledger belongs to.
metered_events: usizeNumber of metered events (tool invocations that produced savings).
net_saved_tokens: u64Net tokens saved over the period — the primary usage signal.
saved_usd: f64USD value of the savings over the period.
last_entry_hash: StringChain head committing the full event history.
chain_valid: boolWhether the SHA-256 chain verified intact.
signed: boolWhether the source aggregate was Ed25519-signed.
Implementations§
Source§impl Usage
impl Usage
Sourcepub const SCHEMA_VERSION: u32 = 1
pub const SCHEMA_VERSION: u32 = 1
Schema version emitted by this build.
Sourcepub fn is_billable(&self) -> bool
pub fn is_billable(&self) -> bool
Whether this usage record is safe to bill on: it must derive from an intact, signed chain. Unsigned/broken aggregates are observable locally but are not billable (fail-closed for billing, never for the user).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Usage
impl<'de> Deserialize<'de> for Usage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Usage
Auto Trait Implementations§
impl Freeze for Usage
impl RefUnwindSafe for Usage
impl Send for Usage
impl Sync for Usage
impl Unpin for Usage
impl UnsafeUnpin for Usage
impl UnwindSafe for Usage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more