pub enum DeclKind {
Struct(StructDecl),
Class(ClassDecl),
Record(RecordDecl),
Fn(FnDecl),
Trait(TraitDecl),
Impl(ImplDecl),
Enum(EnumDecl),
Let(LetStmt),
Import(ImportDecl),
Const(ConstDecl),
Stmt(Stmt),
}Expand description
The kind of a top-level declaration.
Each variant wraps a dedicated declaration struct that carries the variant-specific fields.
Variants§
Struct(StructDecl)
Struct declaration: struct Foo { ... }
Class(ClassDecl)
Class declaration: class Foo { ... } (mutable fields, heap-allocated)
Record(RecordDecl)
Record declaration: record Foo { ... } (immutable value type)
Fn(FnDecl)
Function declaration: fn foo(...) { ... }
Trait(TraitDecl)
Trait declaration: trait Foo { ... }
Impl(ImplDecl)
Impl block: impl Foo { ... } or impl Trait for Foo { ... }
Enum(EnumDecl)
Enum declaration: enum Foo { A, B(i64) }
Let(LetStmt)
Top-level let binding: let x = expr;
Import(ImportDecl)
Import declaration: import path.to.module
Const(ConstDecl)
Compile-time constant: const NAME: Type = expr;
Stmt(Stmt)
Top-level statement (expression statement, if, while, etc.)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeclKind
impl RefUnwindSafe for DeclKind
impl Send for DeclKind
impl Sync for DeclKind
impl Unpin for DeclKind
impl UnsafeUnpin for DeclKind
impl UnwindSafe for DeclKind
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