pub enum TokenKind {
NoDash,
OneDash,
TwoDashes,
AfterOneDash,
AfterEquals,
}
Expand description
The kind of the current token.
This enum acts as the state of the currently parsed argument; this is necessary because an argument can consist of multiple tokens.
Variants§
NoDash
An argument that doesn’t start with dashes, e.g. program
.
OneDash
An argument that starts with exactly 1 dash, e.g. -foo
, -V
,
-h=config
.
TwoDashes
An argument that starts with 2 or more dashes, e.g. --version
or
--help=config
.
AfterOneDash
An option or value of a single-dash argument, after an option has been eaten.
§Example when parsing -abcd=efg,hij
abcd=efg # OneDash
bcd=efg # AfterOneDash
cd=efg # AfterOneDash
efg # AfterEquals
AfterEquals
A value of an argument after the =
, after the name of the argument has
been eaten.
§Example when parsing --abcd=efg,hij
abcd=efg,hij # TwoDashes
efg,hij # AfterEquals
hij # AfterEquals
Trait Implementations§
impl Copy for TokenKind
impl Eq for TokenKind
impl StructuralPartialEq for TokenKind
Auto Trait Implementations§
impl Freeze for TokenKind
impl RefUnwindSafe for TokenKind
impl Send for TokenKind
impl Sync for TokenKind
impl Unpin for TokenKind
impl UnwindSafe for TokenKind
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)