UnrecognizedToken

Struct UnrecognizedToken 

Source
pub struct UnrecognizedToken<'a> { /* private fields */ }
Expand description

Parsing failure due to an unrecognized attribute or enum discriminator

This struct encapsulates a token that the parser tried to consume but did not recognize, along with a TokenStream containing tokens that directly follow this token. In other words, it should be constructed from both values returned by TokenStream::take.

Implementations§

Source§

impl<'a> UnrecognizedToken<'a>

Source

pub fn new(token: Token<'a>, remaining: TokenStream<'a>) -> Self

Create a new UnrecognizedToken instance from a token that was not recognized by the parser and the remaining tokens stream.

Source

pub fn token(&self) -> Token<'a>

Returns a token that was not recognized by the parser.

Source

pub fn remaining(&self) -> &TokenStream<'a>

Returns a token stream that represents tokens that follow the token.

Source

pub fn into_error(self) -> ParseError<'a>

Converts this UnrecognizedToken into a ParseError.

Trait Implementations§

Source§

impl<'a> Debug for UnrecognizedToken<'a>

Source§

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

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

impl<'a> From<UnrecognizedToken<'a>> for ParseFailure<'a>

Source§

fn from(unrecognized: UnrecognizedToken<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for UnrecognizedToken<'a>

§

impl<'a> RefUnwindSafe for UnrecognizedToken<'a>

§

impl<'a> Send for UnrecognizedToken<'a>

§

impl<'a> Sync for UnrecognizedToken<'a>

§

impl<'a> Unpin for UnrecognizedToken<'a>

§

impl<'a> UnwindSafe for UnrecognizedToken<'a>

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> ParsableTransformation<Box<T>> for T

Source§

type Input = T

The type that will be transformed by the implementation if this trait (Self::Input -> O).
Source§

fn transform( input: <T as ParsableTransformation<Box<T>>>::Input, ) -> Result<Box<T>, ParseError<'static>>

Performs the transformation.
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.