Enum rustc_expand::expand::AstFragment
source · pub enum AstFragment {
Show 17 variants
OptExpr(Option<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>>)
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
sourceimpl AstFragment
impl AstFragment
pub fn add_placeholders(&mut self, placeholders: &[NodeId])
pub fn make_opt_expr(self) -> Option<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 fn mut_visit_with<F: MutVisitor>(&mut self, vis: &mut F)
pub fn visit_with<'a, V: Visitor<'a>>(&'a self, visitor: &mut V)
Auto Trait Implementations
impl !RefUnwindSafe for AstFragment
impl !Send for AstFragment
impl !Sync for AstFragment
impl Unpin for AstFragment
impl !UnwindSafe for AstFragment
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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: 136 bytes
Size for each variant:
OptExpr
: 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
: 128 bytesCrate
: 56 bytes