pub trait Command: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn execute<'a>(
&'a self,
ctx: &'a mut BackendContext<'_>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'a>>;
// Provided methods
fn aliases(&self) -> &[&'static str] { ... }
fn help(&self) -> Option<&'static str> { ... }
fn matches(&self, msg: &str) -> bool { ... }
}Expand description
命令 trait,用于实现后端命令
每个命令需要实现此 trait 并注册到 CommandRegistry。
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".