Struct PunctuatedParser

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

Source§

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 M: Freeze, D: Freeze,

§

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

§

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

§

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

§

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

§

impl<T, M, D> UnwindSafe for PunctuatedParser<T, M, D>
where M: UnwindSafe, D: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

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.