Enum TopEntryPoint
pub enum TopEntryPoint {
SourceFile,
MacroStmts,
MacroItems,
Pattern,
Type,
Expr,
MetaItem,
}
Expand description
Parse the whole of the input as a given syntactic construct.
This covers two main use-cases:
- Parsing a Rust file.
- Parsing a result of macro expansion.
That is, for something like
quick_check! {
fn prop() {}
}
the input to the macro will be parsed with [PrefixEntryPoint::Item
], and
the result will be TopEntryPoint::MacroItems
.
TopEntryPoint::parse
makes a guarantee that
- all input is consumed
- the result is a valid tree (there’s one root node)
Variants§
SourceFile
MacroStmts
MacroItems
Pattern
Type
Expr
MetaItem
Edge case – macros generally don’t expand to attributes, with the
exception of cfg_attr
which does!
Implementations§
§impl TopEntryPoint
impl TopEntryPoint
pub fn parse(&self, input: &Input, edition: Edition) -> Output
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TopEntryPoint
impl RefUnwindSafe for TopEntryPoint
impl Send for TopEntryPoint
impl Sync for TopEntryPoint
impl Unpin for TopEntryPoint
impl UnwindSafe for TopEntryPoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more