pub trait CommandSet: FromStr + Display {
// Required methods
fn variants() -> Vec<String>;
fn arguments(&self) -> &'static str;
fn flags(&self) -> &'static str;
fn desc(&self) -> &'static str;
// Provided methods
fn help_simple(&self) -> String { ... }
fn help_all() -> String { ... }
}
Expand description
A CommandSet is a set of commands (usually an enum) that each represent an action that can be performed. i.e. ‘list’, ‘volume’ etc. Each command can take zero or more arguments and have zero or more flags. Typically an Enum of commands would implement CommandSet trait.
Required Methods§
Sourcefn variants() -> Vec<String>
fn variants() -> Vec<String>
Returns a vector of strings that are the commands supported by this.
Sourcefn arguments(&self) -> &'static str
fn arguments(&self) -> &'static str
Returns a string listing the arguments that this command takes, in <> brackets
Provided Methods§
Sourcefn help_simple(&self) -> String
fn help_simple(&self) -> String
Help string for this variant (build from Display, arguments and flags by default)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.