rush_sync_server/commands/
command.rs1use crate::core::prelude::*;
2
3#[async_trait::async_trait]
4pub trait Command: Send + Sync + std::fmt::Debug + 'static {
5 fn name(&self) -> &'static str;
6 fn description(&self) -> &'static str;
7 fn matches(&self, command: &str) -> bool;
8
9 async fn execute(&self, args: &[&str]) -> Result<String> {
11 self.execute_sync(args)
13 }
14
15 fn execute_sync(&self, args: &[&str]) -> Result<String> {
17 futures::executor::block_on(self.execute(args))
19 }
20
21 fn priority(&self) -> u8 {
22 50
23 }
24 fn is_available(&self) -> bool {
25 true
26 }
27}