pub trait Command:
Send
+ Sync
+ 'static {
const NAME: &'static str;
const DESCRIPTION: &'static str = "";
// Required method
fn handle(
args: &[String],
) -> impl Future<Output = Result<(), AppError>> + Send;
}Expand description
A named CLI command, run once, synchronously, in the same process that
dispatched it - see this crate’s own module doc for the full
comparison against larust_queue::Job.
Required Associated Constants§
Provided Associated Constants§
Sourceconst DESCRIPTION: &'static str = ""
const DESCRIPTION: &'static str = ""
A one-line description, shown by xr command:list. Optional -
defaults to empty rather than requiring every command to supply
one, since a name alone is often self-explanatory.
Required Methods§
Sourcefn handle(args: &[String]) -> impl Future<Output = Result<(), AppError>> + Send
fn handle(args: &[String]) -> impl Future<Output = Result<(), AppError>> + Send
Runs the command. args is every token after the command’s own
name (xr report:posts --format=json hands ["--format=json"]) -
parsing them is the command’s own job, the same “no
framework-imposed argument-parsing DSL” stance Job/Notification
already take for their own payloads.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".