pub trait Parser<T: TokenTreeExt> {
type Output<'p, 'b>
where Self: 'p;
// Required method
fn parse<'p, 'b>(
&'p self,
buf: &mut &'b TokenBuf<T>,
) -> Result<Self::Output<'p, 'b>, Error<T::Span>>;
// Provided methods
fn parse_all<'p, 'b>(
&'p self,
buf: &mut &'b TokenBuf<T>,
) -> Result<Self::Output<'p, 'b>, Error<T::Span>> { ... }
fn optional(self) -> Optional<Self>
where Self: Sized { ... }
}
Expand description
A parser for parsing values from a TokenBuf
.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn parse_all<'p, 'b>(
&'p self,
buf: &mut &'b TokenBuf<T>,
) -> Result<Self::Output<'p, 'b>, Error<T::Span>>
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.
The referenced &TokenBuf
will be modified to point past the parsed tokens on success.
If parsing succeeds but there are tokens left in the buffer, the buffer will point
to the left over tokens.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.