rush_sync_server/commands/performance/
command.rs

1// =====================================================
2// FILE: src/commands/performance/command.rs - TRAIT IMPL
3// =====================================================
4
5use crate::commands::command::Command;
6use crate::core::prelude::*;
7
8#[derive(Debug)]
9pub struct PerformanceCommand;
10
11impl Command for PerformanceCommand {
12    fn name(&self) -> &'static str {
13        "performance"
14    }
15
16    fn description(&self) -> &'static str {
17        "Show performance statistics and current config values"
18    }
19
20    fn matches(&self, command: &str) -> bool {
21        let cmd = command.trim().to_lowercase();
22        cmd == "perf" || cmd == "performance" || cmd == "stats" || cmd.starts_with("perf ")
23    }
24
25    fn execute_sync(&self, args: &[&str]) -> Result<String> {
26        match args.first() {
27            Some(&"--help" | &"-h") => Ok(crate::i18n::get_command_translation(
28                "system.commands.performance.help",
29                &[],
30            )),
31            None => super::manager::PerformanceManager::get_status(),
32            _ => Ok(crate::i18n::get_command_translation(
33                "system.commands.performance.unknown",
34                &[],
35            )),
36        }
37    }
38
39    fn priority(&self) -> u8 {
40        25 // Standard Priorität für System-Commands
41    }
42}