pub trait Command: Send + Sync {
// Required methods
fn signature(&self) -> CommandSignature;
fn execute(&self, args: &[String]) -> Result<i32, CliError>;
}Expand description
自定义控制台命令 trait
对齐 PHP think\console\Command 抽象基类。
PHP 端通过继承 Command 并实现 configure() 与 execute() 方法定义命令;
Rust 端通过实现此 trait 达到相同效果。
Required Methods§
Sourcefn signature(&self) -> CommandSignature
fn signature(&self) -> CommandSignature
获取命令签名
对齐 PHP think\console\Command::configure()。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".