Skip to main content

Mountain/IPC/StatusReporter/
mountain_get_performance_metrics.rs

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