Enum jargon_args::Key
source · pub enum Key {
Dual {
char: char,
s_txt: char,
l_txt: String,
},
Long {
char: char,
txt: String,
},
Short {
char: char,
txt: char,
},
Sub {
txt: String,
},
}Expand description
Key
This is the Key enum that represents processable arguments. This has four variants.
Dual
Key::Dual represents ONLY Key::Long and Key::Short in one, they both must start with the same character.
let key: jargon_args::Key = ["-a", "--all"].into();
assert!(key.is_dual())Long
Key::Long represents a full name argument like --all.
let key: jargon_args::Key = "--all".into();
assert!(key.is_long())Short
Key::Short represents a single letter argument like -a.
let key: jargon_args::Key = "-a".into();
assert!(key.is_short())sub
Key::Sub represents a subcommand argument, anything not converted into any other time becomes Key::Sub.
let key: jargon_args::Key = "list".into();
assert!(key.is_sub())Variants§
Dual
Fields
Dual
Key::Dual represents ONLY Key::Long and Key::Short in one, they both must start with the same character.
let key: jargon_args::Key = ["-a", "--all"].into();
assert!(key.is_dual())Long
Fields
Long
Key::Long represents a full name argument like --all.
let key: jargon_args::Key = "--all".into();
assert!(key.is_long())Short
Fields
Short
Key::Short represents a single letter argument like -a.
let key: jargon_args::Key = "-a".into();
assert!(key.is_short())Sub
sub
Key::Sub represents a subcommand argument, anything not converted into any other time becomes Key::Sub.
let key: jargon_args::Key = "list".into();
assert!(key.is_sub())Implementations§
Trait Implementations§
source§impl Ord for Key
impl Ord for Key
source§impl PartialOrd<Key> for Key
impl PartialOrd<Key> for Key
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for Key
impl StructuralEq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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