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
§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())
Fields
Long
§Long
Key::Long represents a full name argument like --all
.
let key: jargon_args::Key = "--all".into();
assert!(key.is_long())
Fields
Short
§Short
Key::Short represents a single letter argument like -a
.
let key: jargon_args::Key = "-a".into();
assert!(key.is_short())
Fields
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 for Key
impl PartialOrd for Key
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
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