pub enum CommandSpec {
Discriminated {
forms: IndexMap<String, CommandForm>,
fallback: Option<CommandForm>,
},
Single(CommandForm),
}Variants§
Discriminated
A command whose structure depends on a discriminator token, usually the first positional argument.
Fields
§
forms: IndexMap<String, CommandForm>Known forms keyed by normalized discriminator token.
§
fallback: Option<CommandForm>Fallback form to use when no discriminator matches.
Single(CommandForm)
A command with a single argument structure.
Implementations§
Source§impl CommandSpec
impl CommandSpec
Sourcepub fn form_for(&self, first_arg: Option<&str>) -> &CommandForm
pub fn form_for(&self, first_arg: Option<&str>) -> &CommandForm
Resolve the command form for a specific invocation.
first_arg is typically the first non-comment argument in the call and
is used for discriminated commands such as file(...) or install(...).
Trait Implementations§
Source§impl Clone for CommandSpec
impl Clone for CommandSpec
Source§fn clone(&self) -> CommandSpec
fn clone(&self) -> CommandSpec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandSpec
impl Debug for CommandSpec
Source§impl<'de> Deserialize<'de> for CommandSpec
impl<'de> Deserialize<'de> for CommandSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CommandSpec
impl PartialEq for CommandSpec
impl Eq for CommandSpec
impl StructuralPartialEq for CommandSpec
Auto Trait Implementations§
impl Freeze for CommandSpec
impl RefUnwindSafe for CommandSpec
impl Send for CommandSpec
impl Sync for CommandSpec
impl Unpin for CommandSpec
impl UnsafeUnpin for CommandSpec
impl UnwindSafe for CommandSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.