Struct parkour::StringInput [−][src]
The default input type for argument parsing. This is generic over its
iterator type and can be used with std::env::args
. See
StringInput::new()
for more information.
Getting the current token and token kind is very cheap. Bumping the token is a bit more expensive, since it involves more complicated logic and might re-allocate.
Implementations
impl<I> StringInput<I> where
I: Iterator<Item = String>,
[src]
I: Iterator<Item = String>,
pub fn new(iter: I) -> StringInput<I>
[src]
Creates a new instance of this input.
Example:
let mut _input = StringInput::new(std::env::args());
You probably want to discard the first argument in this case, which is just the path to the executable.
Trait Implementations
impl<I> Input for StringInput<I> where
I: Iterator<Item = String>,
[src]
I: Iterator<Item = String>,
pub fn current(&self) -> Option<(&str, TokenKind)>
[src]
pub fn current_str_with_leading_dashes(&self) -> Option<&str>
[src]
pub fn bump(&mut self, len: usize) -> &str
[src]
pub fn bump_with_leading_dashes(&mut self, len: usize) -> &str
[src]
pub fn bump_argument(&mut self) -> Option<&str>
[src]
pub fn set_ignore_dashes(&mut self, ignore: bool)
[src]
pub fn ignore_dashes(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn is_not_empty(&self) -> bool
[src]
pub fn can_parse_value_no_whitespace(&self) -> bool
[src]
pub fn can_parse_dash_argument(&self) -> bool
[src]
pub fn eat_no_dash(&mut self, token: &'a str) -> Option<&str>
[src]
pub fn eat_one_dash(&mut self, token: &'a str) -> Option<&str>
[src]
pub fn eat_two_dashes(&mut self, token: &'a str) -> Option<&str>
[src]
pub fn eat_value(&mut self, token: &'a str) -> Option<&str>
[src]
pub fn eat_value_allows_leading_dashes(
&mut self,
token: &'a str
) -> Option<&str>
[src]
&mut self,
token: &'a str
) -> Option<&str>
pub fn no_dash(&mut self) -> Option<InputPart<'_, Self>>
[src]
pub fn one_dash(&mut self) -> Option<InputPart<'_, Self>>
[src]
pub fn two_dashes(&mut self) -> Option<InputPart<'_, Self>>
[src]
pub fn value(&mut self) -> Option<InputPart<'_, Self>>
[src]
pub fn value_allows_leading_dashes(&mut self) -> Option<InputPartLD<'_, Self>>
[src]
Auto Trait Implementations
impl<I> RefUnwindSafe for StringInput<I> where
I: RefUnwindSafe,
[src]
I: RefUnwindSafe,
impl<I> Send for StringInput<I> where
I: Send,
[src]
I: Send,
impl<I> Sync for StringInput<I> where
I: Sync,
[src]
I: Sync,
impl<I> Unpin for StringInput<I> where
I: Unpin,
[src]
I: Unpin,
impl<I> UnwindSafe for StringInput<I> where
I: UnwindSafe,
[src]
I: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,