pub struct PunctuatedParser<T: TokenTree, M, D>(/* private fields */);
Expand description

Parser for punctuated values.

Implementations§

source§

impl<T: TokenTreeExt, M: Parser<T>, D: Parser<T>> PunctuatedParser<T, M, D>

source

pub const fn new(main: M, delim: D) -> Self

Create a new PunctuatedParser using main as the parser for the main part and delim as the parser for the delimiter.

Trait Implementations§

source§

impl<T: Clone + TokenTree, M: Clone, D: Clone> Clone for PunctuatedParser<T, M, D>

source§

fn clone(&self) -> PunctuatedParser<T, M, D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + TokenTree, M: Debug, D: Debug> Debug for PunctuatedParser<T, M, D>

source§

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

Formats the value using the given formatter. Read more
source§

impl<T: TokenTreeExt, M: Parser<T>, D: Parser<T>> Parser<T> for PunctuatedParser<T, M, D>

§

type Output<'p, 'b> = Punctuated<<M as Parser<T>>::Output<'p, 'b>, <D as Parser<T>>::Output<'p, 'b>> where Self: 'p

The output type of this parser.
source§

fn parse<'p, 'b>( &'p self, buf: &mut &'b TokenBuf<T> ) -> Result<Self::Output<'p, 'b>, Error<T::Span>>

Parse a value from a TokenBuf using this parser. Read more
source§

fn parse_all<'p, 'b>( &'p self, buf: &mut &'b TokenBuf<T> ) -> Result<Self::Output<'p, 'b>, Error<T::Span>>

Parse a value from a TokenBuf buffer, but return an error if there’s any tokens left in the buffer after parsing. Read more
source§

fn optional(self) -> Optional<Self>
where Self: Sized,

Wrap this parser in Optional to make it always succeed and return an option.

Auto Trait Implementations§

§

impl<T, M, D> Freeze for PunctuatedParser<T, M, D>
where D: Freeze, M: Freeze,

§

impl<T, M, D> RefUnwindSafe for PunctuatedParser<T, M, D>

§

impl<T, M, D> Send for PunctuatedParser<T, M, D>
where D: Send, M: Send,

§

impl<T, M, D> Sync for PunctuatedParser<T, M, D>
where D: Sync, M: Sync,

§

impl<T, M, D> Unpin for PunctuatedParser<T, M, D>
where D: Unpin, M: Unpin,

§

impl<T, M, D> UnwindSafe for PunctuatedParser<T, M, D>
where D: UnwindSafe, M: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.