pub struct StatsData {Show 16 fields
pub version: u32,
pub last_computed_date: Option<String>,
pub total_sessions: u64,
pub total_messages: u64,
pub daily_activity: Vec<DailyActivityEntry>,
pub model_usage: HashMap<String, ModelUsage>,
pub daily_tokens_30d: Vec<u64>,
pub forecast_tokens_30d: Vec<u64>,
pub forecast_confidence: f64,
pub forecast_cost_30d: f64,
pub projects_by_cost: Vec<ProjectCost>,
pub most_used_model: Option<MostUsedModel>,
pub this_month_cost: f64,
pub avg_session_cost: f64,
pub cache_hit_ratio: f64,
pub mcp_servers_count: usize,
}Expand description
Stats data structure matching backend API response
Fields§
§version: u32§last_computed_date: Option<String>§total_sessions: u64§total_messages: u64§daily_activity: Vec<DailyActivityEntry>§model_usage: HashMap<String, ModelUsage>§daily_tokens_30d: Vec<u64>§forecast_tokens_30d: Vec<u64>§forecast_confidence: f64§forecast_cost_30d: f64§projects_by_cost: Vec<ProjectCost>§most_used_model: Option<MostUsedModel>§this_month_cost: f64§avg_session_cost: f64§cache_hit_ratio: f64§mcp_servers_count: usizeImplementations§
Source§impl StatsData
impl StatsData
Sourcepub fn total_tokens(&self) -> u64
pub fn total_tokens(&self) -> u64
Calculate total tokens across all models
Sourcepub fn total_cost(&self) -> f64
pub fn total_cost(&self) -> f64
Calculate total cost across all models
Sourcepub fn avg_session_cost(&self) -> f64
pub fn avg_session_cost(&self) -> f64
Average cost per session
Sourcepub fn this_month_sessions(&self) -> u64
pub fn this_month_sessions(&self) -> u64
Sessions count for current month (simplified for WASM)
Sourcepub fn this_week_tokens(&self) -> u64
pub fn this_week_tokens(&self) -> u64
Token count for current week (simplified for WASM)
Sourcepub fn daily_tokens_30d(&self) -> Vec<u64>
pub fn daily_tokens_30d(&self) -> Vec<u64>
Get last 30 days of token activity for sparkline
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StatsData
impl<'de> Deserialize<'de> for StatsData
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for StatsData
impl RefUnwindSafe for StatsData
impl Send for StatsData
impl Sync for StatsData
impl Unpin for StatsData
impl UnwindSafe for StatsData
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
Source§fn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
Tries to deserialize the data, given only the
submit event.Source§impl<CustErr, T, Request> FromReq<GetUrl, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<GetUrl, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Attempts to deserialize the arguments from a request.
Source§impl<CustErr, T, Request> FromReq<Json, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<Json, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Attempts to deserialize the arguments from a request.
Source§impl<CustErr, T, Request> FromReq<PostUrl, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<PostUrl, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Attempts to deserialize the arguments from a request.
Source§impl<CustErr, T, Response> FromRes<Json, Response, CustErr> for T
impl<CustErr, T, Response> FromRes<Json, Response, CustErr> for T
Source§async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>
async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>
Attempts to deserialize the outputs from a response.
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>
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 moreSource§impl<CustErr, T, Response> IntoRes<Json, Response, CustErr> for T
impl<CustErr, T, Response> IntoRes<Json, Response, CustErr> for T
Source§async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>
async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>
Attempts to serialize the output into an HTTP response.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.