Parsing

Struct Parsing 

Source
pub struct Parsing<'a, T, O, F> { /* private fields */ }
Expand description

Parsing state holds a reference of Input.

Implementations§

Source§

impl<'a, T, O, F> Parsing<'a, T, O, F>
where F: Future<Output = O> + 'a,

Source

pub fn new<P: Parser<'a, T, O, F>>(input: &'a mut Input<T>, parser: P) -> Self

Create a new Parsing from Input and a parser.

Source

pub fn poll(&mut self) -> bool
where F: Unpin,

Run the parser. Return true if the parser is done. You shouldn’t call this anymore. It may leads to panic or never return. Return false if the parser is pending. You should add more items to the buffer.

Source§

impl<'a, T, O, F> Parsing<'a, T, O, F>

Source

pub fn cursor(&self) -> impl Deref<Target = Cursor<T>> + '_

Get the reference of Cursor.

Source

pub fn cursor_mut(&mut self) -> impl DerefMut<Target = Cursor<T>> + '_

Get the mutable reference of Cursor. You can add items to the buffer.

Source

pub fn into_result(self) -> Option<O>

Get the result of the parser. Return Some(_) if the parser is done (= poll() returned true). Return None otherwise.

Trait Implementations§

Source§

impl<'a, T: Debug, O: Debug, F: Debug> Debug for Parsing<'a, T, O, F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T, O, F> Freeze for Parsing<'a, T, O, F>
where F: Freeze, O: Freeze,

§

impl<'a, T, O, F> !RefUnwindSafe for Parsing<'a, T, O, F>

§

impl<'a, T, O, F> !Send for Parsing<'a, T, O, F>

§

impl<'a, T, O, F> !Sync for Parsing<'a, T, O, F>

§

impl<'a, T, O, F> Unpin for Parsing<'a, T, O, F>
where F: Unpin, O: Unpin,

§

impl<'a, T, O, F> !UnwindSafe for Parsing<'a, T, O, F>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.