Skip to main content

Mountain/IPC/AdvancedFeatures/
mountain_get_performance_stats.rs

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