pub struct Parser<'input> { /* private fields */ }
Expand description
A recursive-descent parser for parsing version requirements.
Implementations§
Source§impl<'input> Parser<'input>
impl<'input> Parser<'input>
Sourcepub fn new(input: &'input str) -> Result<Parser<'input>, Error<'input>>
pub fn new(input: &'input str) -> Result<Parser<'input>, Error<'input>>
Construct a new parser for the given input.
Sourcepub fn component(&mut self) -> Result<Option<u64>, Error<'input>>
pub fn component(&mut self) -> Result<Option<u64>, Error<'input>>
Parse a single component.
Returns None
if the component is a wildcard.
Sourcepub fn dot_component(&mut self) -> Result<(Option<u64>, bool), Error<'input>>
pub fn dot_component(&mut self) -> Result<(Option<u64>, bool), Error<'input>>
Optionally parse a dot, then a component.
The second component of the tuple indicates if a wildcard has been encountered, and is
always false
if the first component is Some
.
If a dot is not encountered, (None, false)
is returned.
If a wildcard is encountered, (None, true)
is returned.
Sourcepub fn dot_numeric(&mut self) -> Result<u64, Error<'input>>
pub fn dot_numeric(&mut self) -> Result<u64, Error<'input>>
Parse a dot, then a numeric.
Sourcepub fn identifier(&mut self) -> Result<Identifier, Error<'input>>
pub fn identifier(&mut self) -> Result<Identifier, Error<'input>>
Parse an string identifier.
Like, foo
, or bar
, or beta-1
.
Auto Trait Implementations§
impl<'input> Freeze for Parser<'input>
impl<'input> RefUnwindSafe for Parser<'input>
impl<'input> Send for Parser<'input>
impl<'input> Sync for Parser<'input>
impl<'input> Unpin for Parser<'input>
impl<'input> UnwindSafe for Parser<'input>
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