pub trait Command:
Send
+ Sync
+ Debug
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn matches(&self, command: &str) -> bool;
fn execute_sync(&self, args: &[&str]) -> Result<String>;
// Provided methods
fn execute_async<'a>(
&'a self,
args: &'a [&'a str],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>> { ... }
fn supports_async(&self) -> bool { ... }
fn priority(&self) -> u8 { ... }
fn is_available(&self) -> bool { ... }
}Expand description
✅ OBJECT-SAFE Command Trait - Box
Required Methods§
Sourcefn description(&self) -> &'static str
fn description(&self) -> &'static str
Command Beschreibung
Sourcefn execute_sync(&self, args: &[&str]) -> Result<String>
fn execute_sync(&self, args: &[&str]) -> Result<String>
Synchrone Ausführung
Provided Methods§
Sourcefn execute_async<'a>(
&'a self,
args: &'a [&'a str],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
fn execute_async<'a>( &'a self, args: &'a [&'a str], ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
✅ OBJECT-SAFE: Asynchrone Ausführung mit Pin<Box<…>>
Sourcefn supports_async(&self) -> bool
fn supports_async(&self) -> bool
Unterstützt async?
Sourcefn is_available(&self) -> bool
fn is_available(&self) -> bool
Ist Command verfügbar?