pub enum AstFragment {
Show 18 variants
OptExpr(Option<P<Expr>>),
MethodReceiverExpr(P<Expr>),
Expr(P<Expr>),
Pat(P<Pat>),
Ty(P<Ty>),
Stmts(SmallVec<[Stmt; 1]>),
Items(SmallVec<[P<Item>; 1]>),
TraitItems(SmallVec<[P<AssocItem>; 1]>),
ImplItems(SmallVec<[P<AssocItem>; 1]>),
ForeignItems(SmallVec<[P<ForeignItem>; 1]>),
Arms(SmallVec<[Arm; 1]>),
ExprFields(SmallVec<[ExprField; 1]>),
PatFields(SmallVec<[PatField; 1]>),
GenericParams(SmallVec<[GenericParam; 1]>),
Params(SmallVec<[Param; 1]>),
FieldDefs(SmallVec<[FieldDef; 1]>),
Variants(SmallVec<[Variant; 1]>),
Crate(Crate),
}
Expand description
A fragment of AST that can be produced by a single macro expansion. Can also serve as an input and intermediate result for macro expansion operations.
Variants§
OptExpr(Option<P<Expr>>)
MethodReceiverExpr(P<Expr>)
Expr(P<Expr>)
Pat(P<Pat>)
Ty(P<Ty>)
Stmts(SmallVec<[Stmt; 1]>)
Items(SmallVec<[P<Item>; 1]>)
TraitItems(SmallVec<[P<AssocItem>; 1]>)
ImplItems(SmallVec<[P<AssocItem>; 1]>)
ForeignItems(SmallVec<[P<ForeignItem>; 1]>)
Arms(SmallVec<[Arm; 1]>)
ExprFields(SmallVec<[ExprField; 1]>)
PatFields(SmallVec<[PatField; 1]>)
GenericParams(SmallVec<[GenericParam; 1]>)
Params(SmallVec<[Param; 1]>)
FieldDefs(SmallVec<[FieldDef; 1]>)
Variants(SmallVec<[Variant; 1]>)
Crate(Crate)
Implementations§
Source§impl AstFragment
impl AstFragment
fn add_placeholders(&mut self, placeholders: &[NodeId])
pub(crate) fn make_opt_expr(self) -> Option<P<Expr>>
pub(crate) fn make_method_receiver_expr(self) -> P<Expr>
pub fn make_expr(self) -> P<Expr>
pub fn make_pat(self) -> P<Pat>
pub fn make_ty(self) -> P<Ty>
pub fn make_stmts(self) -> SmallVec<[Stmt; 1]>
pub fn make_items(self) -> SmallVec<[P<Item>; 1]>
pub fn make_trait_items(self) -> SmallVec<[P<AssocItem>; 1]>
pub fn make_impl_items(self) -> SmallVec<[P<AssocItem>; 1]>
pub fn make_foreign_items(self) -> SmallVec<[P<ForeignItem>; 1]>
pub fn make_arms(self) -> SmallVec<[Arm; 1]>
pub fn make_expr_fields(self) -> SmallVec<[ExprField; 1]>
pub fn make_pat_fields(self) -> SmallVec<[PatField; 1]>
pub fn make_generic_params(self) -> SmallVec<[GenericParam; 1]>
pub fn make_params(self) -> SmallVec<[Param; 1]>
pub fn make_field_defs(self) -> SmallVec<[FieldDef; 1]>
pub fn make_variants(self) -> SmallVec<[Variant; 1]>
pub fn make_crate(self) -> Crate
fn make_ast<T: InvocationCollectorNode>(self) -> T::OutputTy
pub(crate) fn mut_visit_with<F: MutVisitor>(&mut self, vis: &mut F)
pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V) -> V::Result
Auto Trait Implementations§
impl DynSend for AstFragment
impl DynSync for AstFragment
impl Freeze for AstFragment
impl !RefUnwindSafe for AstFragment
impl !Send for AstFragment
impl !Sync for AstFragment
impl Unpin for AstFragment
impl !UnwindSafe for AstFragment
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, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 120 bytes
Size for each variant:
OptExpr
: 8 bytesMethodReceiverExpr
: 8 bytesExpr
: 8 bytesPat
: 8 bytesTy
: 8 bytesStmts
: 40 bytesItems
: 24 bytesTraitItems
: 24 bytesImplItems
: 24 bytesForeignItems
: 24 bytesArms
: 56 bytesExprFields
: 56 bytesPatFields
: 56 bytesGenericParams
: 104 bytesParams
: 48 bytesFieldDefs
: 88 bytesVariants
: 112 bytesCrate
: 40 bytes