Generate From impls for Any* nodes

This commit is contained in:
Lukas Wirth 2024-07-25 10:18:01 +02:00
parent 62a7468d46
commit 200a01adc4
3 changed files with 634 additions and 19 deletions

View file

@ -5106,6 +5106,14 @@ impl AstNode for AnyHasArgList {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<CallExpr> for AnyHasArgList {
#[inline]
fn from(node: CallExpr) -> AnyHasArgList { AnyHasArgList { syntax: node.syntax } }
}
impl From<MethodCallExpr> for AnyHasArgList {
#[inline]
fn from(node: MethodCallExpr) -> AnyHasArgList { AnyHasArgList { syntax: node.syntax } }
}
impl AnyHasAttrs {
#[inline]
pub fn new<T: ast::HasAttrs>(node: T) -> AnyHasAttrs {
@ -5198,6 +5206,294 @@ impl AstNode for AnyHasAttrs {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<ArrayExpr> for AnyHasAttrs {
#[inline]
fn from(node: ArrayExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<AsmExpr> for AnyHasAttrs {
#[inline]
fn from(node: AsmExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<AssocItemList> for AnyHasAttrs {
#[inline]
fn from(node: AssocItemList) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<AwaitExpr> for AnyHasAttrs {
#[inline]
fn from(node: AwaitExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<BecomeExpr> for AnyHasAttrs {
#[inline]
fn from(node: BecomeExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<BinExpr> for AnyHasAttrs {
#[inline]
fn from(node: BinExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<BlockExpr> for AnyHasAttrs {
#[inline]
fn from(node: BlockExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<BreakExpr> for AnyHasAttrs {
#[inline]
fn from(node: BreakExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<CallExpr> for AnyHasAttrs {
#[inline]
fn from(node: CallExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<CastExpr> for AnyHasAttrs {
#[inline]
fn from(node: CastExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ClosureExpr> for AnyHasAttrs {
#[inline]
fn from(node: ClosureExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Const> for AnyHasAttrs {
#[inline]
fn from(node: Const) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ConstParam> for AnyHasAttrs {
#[inline]
fn from(node: ConstParam) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ContinueExpr> for AnyHasAttrs {
#[inline]
fn from(node: ContinueExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Enum> for AnyHasAttrs {
#[inline]
fn from(node: Enum) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ExternBlock> for AnyHasAttrs {
#[inline]
fn from(node: ExternBlock) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ExternCrate> for AnyHasAttrs {
#[inline]
fn from(node: ExternCrate) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ExternItemList> for AnyHasAttrs {
#[inline]
fn from(node: ExternItemList) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<FieldExpr> for AnyHasAttrs {
#[inline]
fn from(node: FieldExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Fn> for AnyHasAttrs {
#[inline]
fn from(node: Fn) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ForExpr> for AnyHasAttrs {
#[inline]
fn from(node: ForExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<FormatArgsExpr> for AnyHasAttrs {
#[inline]
fn from(node: FormatArgsExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<IdentPat> for AnyHasAttrs {
#[inline]
fn from(node: IdentPat) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<IfExpr> for AnyHasAttrs {
#[inline]
fn from(node: IfExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Impl> for AnyHasAttrs {
#[inline]
fn from(node: Impl) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<IndexExpr> for AnyHasAttrs {
#[inline]
fn from(node: IndexExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ItemList> for AnyHasAttrs {
#[inline]
fn from(node: ItemList) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<LetExpr> for AnyHasAttrs {
#[inline]
fn from(node: LetExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<LetStmt> for AnyHasAttrs {
#[inline]
fn from(node: LetStmt) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<LifetimeParam> for AnyHasAttrs {
#[inline]
fn from(node: LifetimeParam) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Literal> for AnyHasAttrs {
#[inline]
fn from(node: Literal) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<LoopExpr> for AnyHasAttrs {
#[inline]
fn from(node: LoopExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<MacroCall> for AnyHasAttrs {
#[inline]
fn from(node: MacroCall) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<MacroDef> for AnyHasAttrs {
#[inline]
fn from(node: MacroDef) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<MacroRules> for AnyHasAttrs {
#[inline]
fn from(node: MacroRules) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<MatchArm> for AnyHasAttrs {
#[inline]
fn from(node: MatchArm) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<MatchArmList> for AnyHasAttrs {
#[inline]
fn from(node: MatchArmList) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<MatchExpr> for AnyHasAttrs {
#[inline]
fn from(node: MatchExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<MethodCallExpr> for AnyHasAttrs {
#[inline]
fn from(node: MethodCallExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Module> for AnyHasAttrs {
#[inline]
fn from(node: Module) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<OffsetOfExpr> for AnyHasAttrs {
#[inline]
fn from(node: OffsetOfExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Param> for AnyHasAttrs {
#[inline]
fn from(node: Param) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ParenExpr> for AnyHasAttrs {
#[inline]
fn from(node: ParenExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<PathExpr> for AnyHasAttrs {
#[inline]
fn from(node: PathExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<PrefixExpr> for AnyHasAttrs {
#[inline]
fn from(node: PrefixExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<RangeExpr> for AnyHasAttrs {
#[inline]
fn from(node: RangeExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<RecordExprField> for AnyHasAttrs {
#[inline]
fn from(node: RecordExprField) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<RecordExprFieldList> for AnyHasAttrs {
#[inline]
fn from(node: RecordExprFieldList) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<RecordField> for AnyHasAttrs {
#[inline]
fn from(node: RecordField) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<RecordPatField> for AnyHasAttrs {
#[inline]
fn from(node: RecordPatField) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<RefExpr> for AnyHasAttrs {
#[inline]
fn from(node: RefExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<RestPat> for AnyHasAttrs {
#[inline]
fn from(node: RestPat) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<ReturnExpr> for AnyHasAttrs {
#[inline]
fn from(node: ReturnExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<SelfParam> for AnyHasAttrs {
#[inline]
fn from(node: SelfParam) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<SourceFile> for AnyHasAttrs {
#[inline]
fn from(node: SourceFile) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Static> for AnyHasAttrs {
#[inline]
fn from(node: Static) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<StmtList> for AnyHasAttrs {
#[inline]
fn from(node: StmtList) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Struct> for AnyHasAttrs {
#[inline]
fn from(node: Struct) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Trait> for AnyHasAttrs {
#[inline]
fn from(node: Trait) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<TraitAlias> for AnyHasAttrs {
#[inline]
fn from(node: TraitAlias) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<TryExpr> for AnyHasAttrs {
#[inline]
fn from(node: TryExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<TupleExpr> for AnyHasAttrs {
#[inline]
fn from(node: TupleExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<TupleField> for AnyHasAttrs {
#[inline]
fn from(node: TupleField) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<TypeAlias> for AnyHasAttrs {
#[inline]
fn from(node: TypeAlias) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<TypeParam> for AnyHasAttrs {
#[inline]
fn from(node: TypeParam) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<UnderscoreExpr> for AnyHasAttrs {
#[inline]
fn from(node: UnderscoreExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Union> for AnyHasAttrs {
#[inline]
fn from(node: Union) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Use> for AnyHasAttrs {
#[inline]
fn from(node: Use) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<Variant> for AnyHasAttrs {
#[inline]
fn from(node: Variant) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<WhileExpr> for AnyHasAttrs {
#[inline]
fn from(node: WhileExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<YeetExpr> for AnyHasAttrs {
#[inline]
fn from(node: YeetExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl From<YieldExpr> for AnyHasAttrs {
#[inline]
fn from(node: YieldExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } }
}
impl AnyHasDocComments {
#[inline]
pub fn new<T: ast::HasDocComments>(node: T) -> AnyHasDocComments {
@ -5239,6 +5535,90 @@ impl AstNode for AnyHasDocComments {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<Const> for AnyHasDocComments {
#[inline]
fn from(node: Const) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Enum> for AnyHasDocComments {
#[inline]
fn from(node: Enum) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<ExternBlock> for AnyHasDocComments {
#[inline]
fn from(node: ExternBlock) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<ExternCrate> for AnyHasDocComments {
#[inline]
fn from(node: ExternCrate) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Fn> for AnyHasDocComments {
#[inline]
fn from(node: Fn) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Impl> for AnyHasDocComments {
#[inline]
fn from(node: Impl) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<MacroCall> for AnyHasDocComments {
#[inline]
fn from(node: MacroCall) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<MacroDef> for AnyHasDocComments {
#[inline]
fn from(node: MacroDef) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<MacroRules> for AnyHasDocComments {
#[inline]
fn from(node: MacroRules) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Module> for AnyHasDocComments {
#[inline]
fn from(node: Module) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<RecordField> for AnyHasDocComments {
#[inline]
fn from(node: RecordField) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<SourceFile> for AnyHasDocComments {
#[inline]
fn from(node: SourceFile) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Static> for AnyHasDocComments {
#[inline]
fn from(node: Static) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Struct> for AnyHasDocComments {
#[inline]
fn from(node: Struct) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Trait> for AnyHasDocComments {
#[inline]
fn from(node: Trait) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<TraitAlias> for AnyHasDocComments {
#[inline]
fn from(node: TraitAlias) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<TupleField> for AnyHasDocComments {
#[inline]
fn from(node: TupleField) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<TypeAlias> for AnyHasDocComments {
#[inline]
fn from(node: TypeAlias) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Union> for AnyHasDocComments {
#[inline]
fn from(node: Union) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Use> for AnyHasDocComments {
#[inline]
fn from(node: Use) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl From<Variant> for AnyHasDocComments {
#[inline]
fn from(node: Variant) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } }
}
impl AnyHasGenericArgs {
#[inline]
pub fn new<T: ast::HasGenericArgs>(node: T) -> AnyHasGenericArgs {
@ -5257,6 +5637,18 @@ impl AstNode for AnyHasGenericArgs {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<AssocTypeArg> for AnyHasGenericArgs {
#[inline]
fn from(node: AssocTypeArg) -> AnyHasGenericArgs { AnyHasGenericArgs { syntax: node.syntax } }
}
impl From<MethodCallExpr> for AnyHasGenericArgs {
#[inline]
fn from(node: MethodCallExpr) -> AnyHasGenericArgs { AnyHasGenericArgs { syntax: node.syntax } }
}
impl From<PathSegment> for AnyHasGenericArgs {
#[inline]
fn from(node: PathSegment) -> AnyHasGenericArgs { AnyHasGenericArgs { syntax: node.syntax } }
}
impl AnyHasGenericParams {
#[inline]
pub fn new<T: ast::HasGenericParams>(node: T) -> AnyHasGenericParams {
@ -5275,6 +5667,38 @@ impl AstNode for AnyHasGenericParams {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<Enum> for AnyHasGenericParams {
#[inline]
fn from(node: Enum) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl From<Fn> for AnyHasGenericParams {
#[inline]
fn from(node: Fn) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl From<Impl> for AnyHasGenericParams {
#[inline]
fn from(node: Impl) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl From<Struct> for AnyHasGenericParams {
#[inline]
fn from(node: Struct) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl From<Trait> for AnyHasGenericParams {
#[inline]
fn from(node: Trait) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl From<TraitAlias> for AnyHasGenericParams {
#[inline]
fn from(node: TraitAlias) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl From<TypeAlias> for AnyHasGenericParams {
#[inline]
fn from(node: TypeAlias) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl From<Union> for AnyHasGenericParams {
#[inline]
fn from(node: Union) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
}
impl AnyHasLoopBody {
#[inline]
pub fn new<T: ast::HasLoopBody>(node: T) -> AnyHasLoopBody {
@ -5291,6 +5715,18 @@ impl AstNode for AnyHasLoopBody {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<ForExpr> for AnyHasLoopBody {
#[inline]
fn from(node: ForExpr) -> AnyHasLoopBody { AnyHasLoopBody { syntax: node.syntax } }
}
impl From<LoopExpr> for AnyHasLoopBody {
#[inline]
fn from(node: LoopExpr) -> AnyHasLoopBody { AnyHasLoopBody { syntax: node.syntax } }
}
impl From<WhileExpr> for AnyHasLoopBody {
#[inline]
fn from(node: WhileExpr) -> AnyHasLoopBody { AnyHasLoopBody { syntax: node.syntax } }
}
impl AnyHasModuleItem {
#[inline]
pub fn new<T: ast::HasModuleItem>(node: T) -> AnyHasModuleItem {
@ -5307,6 +5743,18 @@ impl AstNode for AnyHasModuleItem {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<ItemList> for AnyHasModuleItem {
#[inline]
fn from(node: ItemList) -> AnyHasModuleItem { AnyHasModuleItem { syntax: node.syntax } }
}
impl From<MacroItems> for AnyHasModuleItem {
#[inline]
fn from(node: MacroItems) -> AnyHasModuleItem { AnyHasModuleItem { syntax: node.syntax } }
}
impl From<SourceFile> for AnyHasModuleItem {
#[inline]
fn from(node: SourceFile) -> AnyHasModuleItem { AnyHasModuleItem { syntax: node.syntax } }
}
impl AnyHasName {
#[inline]
pub fn new<T: ast::HasName>(node: T) -> AnyHasName {
@ -5347,6 +5795,86 @@ impl AstNode for AnyHasName {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<Const> for AnyHasName {
#[inline]
fn from(node: Const) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<ConstParam> for AnyHasName {
#[inline]
fn from(node: ConstParam) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Enum> for AnyHasName {
#[inline]
fn from(node: Enum) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Fn> for AnyHasName {
#[inline]
fn from(node: Fn) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<FormatArgsArg> for AnyHasName {
#[inline]
fn from(node: FormatArgsArg) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<IdentPat> for AnyHasName {
#[inline]
fn from(node: IdentPat) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<MacroDef> for AnyHasName {
#[inline]
fn from(node: MacroDef) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<MacroRules> for AnyHasName {
#[inline]
fn from(node: MacroRules) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Module> for AnyHasName {
#[inline]
fn from(node: Module) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<RecordField> for AnyHasName {
#[inline]
fn from(node: RecordField) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Rename> for AnyHasName {
#[inline]
fn from(node: Rename) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<SelfParam> for AnyHasName {
#[inline]
fn from(node: SelfParam) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Static> for AnyHasName {
#[inline]
fn from(node: Static) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Struct> for AnyHasName {
#[inline]
fn from(node: Struct) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Trait> for AnyHasName {
#[inline]
fn from(node: Trait) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<TraitAlias> for AnyHasName {
#[inline]
fn from(node: TraitAlias) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<TypeAlias> for AnyHasName {
#[inline]
fn from(node: TypeAlias) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<TypeParam> for AnyHasName {
#[inline]
fn from(node: TypeParam) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Union> for AnyHasName {
#[inline]
fn from(node: Union) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl From<Variant> for AnyHasName {
#[inline]
fn from(node: Variant) -> AnyHasName { AnyHasName { syntax: node.syntax } }
}
impl AnyHasTypeBounds {
#[inline]
pub fn new<T: ast::HasTypeBounds>(node: T) -> AnyHasTypeBounds {
@ -5368,6 +5896,30 @@ impl AstNode for AnyHasTypeBounds {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<AssocTypeArg> for AnyHasTypeBounds {
#[inline]
fn from(node: AssocTypeArg) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } }
}
impl From<LifetimeParam> for AnyHasTypeBounds {
#[inline]
fn from(node: LifetimeParam) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } }
}
impl From<Trait> for AnyHasTypeBounds {
#[inline]
fn from(node: Trait) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } }
}
impl From<TypeAlias> for AnyHasTypeBounds {
#[inline]
fn from(node: TypeAlias) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } }
}
impl From<TypeParam> for AnyHasTypeBounds {
#[inline]
fn from(node: TypeParam) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } }
}
impl From<WherePred> for AnyHasTypeBounds {
#[inline]
fn from(node: WherePred) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } }
}
impl AnyHasVisibility {
#[inline]
pub fn new<T: ast::HasVisibility>(node: T) -> AnyHasVisibility {
@ -5406,6 +5958,78 @@ impl AstNode for AnyHasVisibility {
#[inline]
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl From<Const> for AnyHasVisibility {
#[inline]
fn from(node: Const) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Enum> for AnyHasVisibility {
#[inline]
fn from(node: Enum) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<ExternCrate> for AnyHasVisibility {
#[inline]
fn from(node: ExternCrate) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Fn> for AnyHasVisibility {
#[inline]
fn from(node: Fn) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Impl> for AnyHasVisibility {
#[inline]
fn from(node: Impl) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<MacroDef> for AnyHasVisibility {
#[inline]
fn from(node: MacroDef) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<MacroRules> for AnyHasVisibility {
#[inline]
fn from(node: MacroRules) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Module> for AnyHasVisibility {
#[inline]
fn from(node: Module) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<RecordField> for AnyHasVisibility {
#[inline]
fn from(node: RecordField) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Static> for AnyHasVisibility {
#[inline]
fn from(node: Static) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Struct> for AnyHasVisibility {
#[inline]
fn from(node: Struct) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Trait> for AnyHasVisibility {
#[inline]
fn from(node: Trait) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<TraitAlias> for AnyHasVisibility {
#[inline]
fn from(node: TraitAlias) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<TupleField> for AnyHasVisibility {
#[inline]
fn from(node: TupleField) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<TypeAlias> for AnyHasVisibility {
#[inline]
fn from(node: TypeAlias) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Union> for AnyHasVisibility {
#[inline]
fn from(node: Union) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Use> for AnyHasVisibility {
#[inline]
fn from(node: Use) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl From<Variant> for AnyHasVisibility {
#[inline]
fn from(node: Variant) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } }
}
impl std::fmt::Display for Adt {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)

View file

@ -1127,21 +1127,3 @@ impl From<ast::AssocItem> for ast::AnyHasAttrs {
Self::new(node)
}
}
impl From<ast::Variant> for ast::AnyHasAttrs {
fn from(node: ast::Variant) -> Self {
Self::new(node)
}
}
impl From<ast::RecordField> for ast::AnyHasAttrs {
fn from(node: ast::RecordField) -> Self {
Self::new(node)
}
}
impl From<ast::TupleField> for ast::AnyHasAttrs {
fn from(node: ast::TupleField) -> Self {
Self::new(node)
}
}

View file

@ -261,7 +261,7 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String {
.iter()
.map(|name| format_ident!("{}", to_upper_snake_case(&name.name.to_string())))
.collect();
let nodes = nodes.iter().map(|node| format_ident!("{}", node.name));
(
quote! {
#[pretty_doc_comment_placeholder_workaround]
@ -294,6 +294,15 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String {
&self.syntax
}
}
#(
impl From<#nodes> for #name {
#[inline]
fn from(node: #nodes) -> #name {
#name { syntax: node.syntax }
}
}
)*
},
)
})