Skip to main content

Mountain/IPC/AdvancedFeatures/
mountain_get_performance_stats.rs

1//! `mountain_get_performance_stats` Tauri command - returns
2//! the cumulative `PerformanceStats::Struct`.
3
4use tauri::Manager;
5
6use crate::{
7	IPC::AdvancedFeatures::{Features::Struct as Features, PerformanceStats::Struct as PerformanceStats},
8	dev_log,
9};
10
11#[tauri::command]
12pub async fn mountain_get_performance_stats(app_handle:tauri::AppHandle) -> Result<PerformanceStats, String> {
13	dev_log!("lifecycle", "Tauri command: get_performance_stats");
14
15	if let Some(features) = app_handle.try_state::<Features>() {
16		features.get_performance_stats().await
17	} else {
18		Err("AdvancedFeatures not found in application state".to_string())
19	}
20}