pub trait Command: Sized {
type Id: CommandId;
type Path: CommandPath<Id = Self::Id>;
// Required methods
fn parse<I: IntoIterator<Item = S>, S: AsRef<str>>(
iter: I,
) -> Result<Self, CommandParseError>;
fn id(&self) -> Self::Id;
}
Expand description
A parsable, identifiable command or family of commands
Required Associated Types§
Sourcetype Path: CommandPath<Id = Self::Id>
type Path: CommandPath<Id = Self::Id>
The type of a valid command path starting at this command
Required Methods§
Sourcefn parse<I: IntoIterator<Item = S>, S: AsRef<str>>(
iter: I,
) -> Result<Self, CommandParseError>
fn parse<I: IntoIterator<Item = S>, S: AsRef<str>>( iter: I, ) -> Result<Self, CommandParseError>
Try to parse a sequence of arguments as a command
§Errors
Should return an error for syntax or command-not-found errors, or for any errors while parsing arguments.
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.