InvocationCollectorNode in rustc_expand::expand - Rust
Description: A trait implemented for all `AstFragment` nodes and providing all pieces of functionality used by `InvocationCollector`.

Skip to main content

## InvocationCollectorNode

# Trait InvocationCollectorNode

Source

    trait InvocationCollectorNode:
        HasAttrs
        + HasNodeId
        + Sized {
        type OutputTy = SmallVec<[Self; 1]>;
        type ItemKind = ItemKind;

        const KIND: AstFragmentKind;
    Show 17 methods
        // Required methods
        fn to_annotatable(self) -> Annotatable;
        fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy;
        fn as_target(&self) -> Target;

        // Provided methods
        fn descr() -> &'static str { ... }
        fn walk_flat_map(
            self,
            _collector: &mut InvocationCollector<'_, '_>,
        ) -> Self::OutputTy { ... }
        fn walk(&mut self, _collector: &mut InvocationCollector<'_, '_>) { ... }
        fn is_mac_call(&self) -> bool { ... }
        fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon) { ... }
        fn delegation(&self) -> Option<(&DelegationMac, &Item<Self::ItemKind>)> { ... }
        fn delegation_item_kind(_deleg: Box<Delegation>) -> Self::ItemKind { ... }
        fn from_item(_item: Item<Self::ItemKind>) -> Self { ... }
        fn flatten_outputs(
            _outputs: impl Iterator<Item = Self::OutputTy>,
        ) -> Self::OutputTy { ... }
        fn pre_flat_map_node_collect_attr(
            _cfg: &StripUnconfigured<'_>,
            _attr: &Attribute,
        ) { ... }
        fn post_flat_map_node_collect_bang(
            _output: &mut Self::OutputTy,
            _add_semicolon: AddSemicolon,
        ) { ... }
        fn wrap_flat_map_node_walk_flat_map(
            node: Self,
            collector: &mut InvocationCollector<'_, '_>,
            walk_flat_map: impl FnOnce(Self, &mut InvocationCollector<'_, '_>) -> Self::OutputTy,
        ) -> Result<Self::OutputTy, Self> { ... }
        fn expand_cfg_false(
            &mut self,
            collector: &mut InvocationCollector<'_, '_>,
            _pos: usize,
            span: Span,
        ) { ... }
        fn declared_idents(&self) -> Vec<Ident> { ... }
    }

Expand description

A trait implemented for all `AstFragment` nodes and providing all pieces of functionality used by `InvocationCollector`.

## Required Associated Constants§

Source

#### const KIND: AstFragmentKind

## Provided Associated Types§

Source

#### type OutputTy = SmallVec<[Self; 1]>

Source

#### type ItemKind = ItemKind

## Required Methods§

Source

#### fn to_annotatable(self) -> Annotatable

Source

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source

#### fn as_target(&self) -> Target

## Provided Methods§

Source

#### fn descr() -> &'static str

Source

#### fn walk_flat_map( self, _collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source

#### fn walk(&mut self, _collector: &mut InvocationCollector<'_, '_>)

Source

#### fn is_mac_call(&self) -> bool

Source

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source

#### fn delegation(&self) -> Option<(&DelegationMac, &Item<Self::ItemKind>)>

Source

#### fn delegation_item_kind(_deleg: Box<Delegation>) -> Self::ItemKind

Source

#### fn from_item(_item: Item<Self::ItemKind>) -> Self

Source

#### fn flatten_outputs( _outputs: impl Iterator<Item = Self::OutputTy>, ) -> Self::OutputTy

Source

#### fn pre_flat_map_node_collect_attr( _cfg: &StripUnconfigured<'_>, _attr: &Attribute, )

Source

#### fn post_flat_map_node_collect_bang( _output: &mut Self::OutputTy, _add_semicolon: AddSemicolon, )

Source

#### fn wrap_flat_map_node_walk_flat_map( node: Self, collector: &mut InvocationCollector<'_, '_>, walk_flat_map: impl FnOnce(Self, &mut InvocationCollector<'_, '_>) -> Self::OutputTy, ) -> Result<Self::OutputTy, Self>

Source

#### fn expand_cfg_false( &mut self, collector: &mut InvocationCollector<'_, '_>, _pos: usize, span: Span, )

Source

#### fn declared_idents(&self) -> Vec<Ident>

All of the identifiers (items) declared by this node. This is an approximation and should only be used for diagnostics.

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

## Implementations on Foreign Types§

Source§

### impl InvocationCollectorNode for Arm

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Arms

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Crate

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Crate

Source§

#### type OutputTy = Crate

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk(&mut self, collector: &mut InvocationCollector<'_, '_>)

Source§

#### fn expand_cfg_false( &mut self, collector: &mut InvocationCollector<'_, '_>, pos: usize, _span: Span, )

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Expr

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Expr

Source§

#### type OutputTy = Box<Expr>

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn descr() -> &'static str

Source§

#### fn walk(&mut self, collector: &mut InvocationCollector<'_, '_>)

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for ExprField

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::ExprFields

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for FieldDef

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::FieldDefs

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for GenericParam

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::GenericParams

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Param

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Params

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Pat

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Pat

Source§

#### type OutputTy = Box<Pat>

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk(&mut self, collector: &mut InvocationCollector<'_, '_>)

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for PatField

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::PatFields

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Stmt

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Stmts

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn delegation(&self) -> Option<(&DelegationMac, &Item<Self::ItemKind>)>

Source§

#### fn delegation_item_kind(deleg: Box<Delegation>) -> Self::ItemKind

Source§

#### fn from_item(item: Item<Self::ItemKind>) -> Self

Source§

#### fn flatten_outputs( items: impl Iterator<Item = Self::OutputTy>, ) -> Self::OutputTy

Source§

#### fn post_flat_map_node_collect_bang( stmts: &mut Self::OutputTy, add_semicolon: AddSemicolon, )

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Ty

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Ty

Source§

#### type OutputTy = Box<Ty>

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk(&mut self, collector: &mut InvocationCollector<'_, '_>)

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Variant

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Variants

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for WherePredicate

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::WherePredicates

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for AstNodeWrapper<Expr, MethodReceiverTag>

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::MethodReceiverExpr

Source§

#### type OutputTy = AstNodeWrapper<Box<Expr>, MethodReceiverTag>

Source§

#### fn descr() -> &'static str

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk(&mut self, collector: &mut InvocationCollector<'_, '_>)

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for AstNodeWrapper<Box<Expr>, OptExprTag>

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::OptExpr

Source§

#### type OutputTy = Option<Box<Expr>>

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn pre_flat_map_node_collect_attr(cfg: &StripUnconfigured<'_>, attr: &Attribute)

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for AstNodeWrapper<Box<AssocItem>, ImplItemTag>

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::ImplItems

Source§

#### type OutputTy = SmallVec<[Box<Item<AssocItemKind>>; 1]>

Source§

#### type ItemKind = AssocItemKind

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn delegation(&self) -> Option<(&DelegationMac, &Item<Self::ItemKind>)>

Source§

#### fn delegation_item_kind(deleg: Box<Delegation>) -> Self::ItemKind

Source§

#### fn from_item(item: Item<Self::ItemKind>) -> Self

Source§

#### fn flatten_outputs( items: impl Iterator<Item = Self::OutputTy>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for AstNodeWrapper<Box<AssocItem>, TraitImplItemTag>

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::TraitImplItems

Source§

#### type OutputTy = SmallVec<[Box<Item<AssocItemKind>>; 1]>

Source§

#### type ItemKind = AssocItemKind

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn delegation(&self) -> Option<(&DelegationMac, &Item<Self::ItemKind>)>

Source§

#### fn delegation_item_kind(deleg: Box<Delegation>) -> Self::ItemKind

Source§

#### fn from_item(item: Item<Self::ItemKind>) -> Self

Source§

#### fn flatten_outputs( items: impl Iterator<Item = Self::OutputTy>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for AstNodeWrapper<Box<AssocItem>, TraitItemTag>

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::TraitItems

Source§

#### type OutputTy = SmallVec<[Box<Item<AssocItemKind>>; 1]>

Source§

#### type ItemKind = AssocItemKind

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn delegation(&self) -> Option<(&DelegationMac, &Item<Self::ItemKind>)>

Source§

#### fn delegation_item_kind(deleg: Box<Delegation>) -> Self::ItemKind

Source§

#### fn from_item(item: Item<Self::ItemKind>) -> Self

Source§

#### fn flatten_outputs( items: impl Iterator<Item = Self::OutputTy>, ) -> Self::OutputTy

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Box<Item>

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::Items

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn delegation(&self) -> Option<(&DelegationMac, &Item<Self::ItemKind>)>

Source§

#### fn delegation_item_kind(deleg: Box<Delegation>) -> Self::ItemKind

Source§

#### fn from_item(item: Item<Self::ItemKind>) -> Self

Source§

#### fn flatten_outputs( items: impl Iterator<Item = Self::OutputTy>, ) -> Self::OutputTy

Source§

#### fn wrap_flat_map_node_walk_flat_map( node: Self, collector: &mut InvocationCollector<'_, '_>, walk_flat_map: impl FnOnce(Self, &mut InvocationCollector<'_, '_>) -> Self::OutputTy, ) -> Result<Self::OutputTy, Self>

Source§

#### fn declared_idents(&self) -> Vec<Ident>

Source§

#### fn as_target(&self) -> Target

Source§

### impl InvocationCollectorNode for Box<ForeignItem>

Source§

#### const KIND: AstFragmentKind = AstFragmentKind::ForeignItems

Source§

#### fn to_annotatable(self) -> Annotatable

Source§

#### fn fragment_to_output(fragment: AstFragment) -> Self::OutputTy

Source§

#### fn walk_flat_map( self, collector: &mut InvocationCollector<'_, '_>, ) -> Self::OutputTy

Source§

#### fn is_mac_call(&self) -> bool

Source§

#### fn take_mac_call(self) -> (Box<MacCall>, AttrVec, AddSemicolon)

Source§

#### fn as_target(&self) -> Target

## Implementors§