pub struct TokenTracker { /* private fields */ }Implementations§
Source§impl TokenTracker
impl TokenTracker
pub fn new(db: Connection) -> Self
pub fn record( &self, agent_pid: u32, provider: &str, prompt_tokens: u32, completion_tokens: u32, pricing: Option<f64>, ) -> Result<(), TokenError>
pub fn get_agent_stats( &self, agent_pid: u32, ) -> Result<AgentTokenStats, TokenError>
pub fn get_all_stats(&self) -> Result<Vec<(u32, AgentTokenStats)>, TokenError>
pub fn get_7day_trend( &self, agent_pid: u32, ) -> Result<Vec<DailyTokenUsage>, TokenError>
pub fn check_budget( &self, agent_pid: u32, budget_tokens: u64, ) -> Result<bool, TokenError>
Auto Trait Implementations§
impl !Freeze for TokenTracker
impl !RefUnwindSafe for TokenTracker
impl Send for TokenTracker
impl !Sync for TokenTracker
impl Unpin for TokenTracker
impl UnsafeUnpin for TokenTracker
impl !UnwindSafe for TokenTracker
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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