[][src]Struct semver_parser::parser::Parser

pub struct Parser<'input> { /* fields omitted */ }

A recursive-descent parser for parsing version requirements.

Implementations

impl<'input> Parser<'input>[src]

pub fn new(input: &'input str) -> Result<Parser<'input>, Error<'input>>[src]

Construct a new parser for the given input.

pub fn component(&mut self) -> Result<Option<u64>, Error<'input>>[src]

Parse a single component.

Returns None if the component is a wildcard.

pub fn numeric(&mut self) -> Result<u64, Error<'input>>[src]

Parse a single numeric.

pub fn dot_component(&mut self) -> Result<(Option<u64>, bool), Error<'input>>[src]

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.

pub fn dot_numeric(&mut self) -> Result<u64, Error<'input>>[src]

Parse a dot, then a numeric.

pub fn identifier(&mut self) -> Result<Identifier, Error<'input>>[src]

Parse an string identifier.

Like, foo, or bar, or beta-1.

pub fn version(&mut self) -> Result<Version, Error<'input>>[src]

Parse a version.

Like, 1.0.0 or 3.0.0-beta.1.

pub fn is_eof(&mut self) -> bool[src]

Check if we have reached the end of input.

pub fn tail(&mut self) -> Result<Vec<Token<'input>>, Error<'input>>[src]

Get the rest of the tokens in the parser.

Useful for debugging.

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.