pub enum ItemKind {
Show 19 variants
Function,
Struct,
Enum,
Trait,
Impl,
TypeAlias,
Const,
Static,
Mod,
Use,
Macro,
Method,
Field,
Variant,
LocalVar,
Parameter,
TupleField,
Any,
Other,
}Expand description
Kind of AST item (shared vocabulary across crates).
This enum represents the type of an AST item and is used for:
- Item-level conflict detection in parallel execution
- Intent extraction and pattern matching
- Spec directives and documentation
§Design
- Top-level items: items that can appear at module level
- Nested items: items that appear inside other items (methods in impl, fields in struct)
- Wildcard: for pattern matching any kind
Variants§
Function
Function definition (fn foo() {})
Struct
Struct definition (struct Foo {})
Enum
Enum definition (enum Foo {})
Trait
Trait definition (trait Foo {})
Impl
Impl block (impl Foo {} or impl Trait for Foo {})
TypeAlias
Type alias (type Foo = Bar;)
Const
Const item (const FOO: i32 = 1;)
Static
Static item (static FOO: i32 = 1;)
Mod
Module (mod foo; or mod foo {})
Use
Use statement (use std::io;)
Macro
Macro invocation at item level (macro_rules! or foo!())
Method
Method inside an impl or trait block
Field
Field in a struct or enum variant
Variant
Variant in an enum
LocalVar
Local variable (let x = ...)
Parameter
Function parameter
TupleField
Tuple struct/enum field (indexed by number: 0, 1, 2…)
Any
Wildcard - matches any kind (for pattern matching)
Other
Unknown or unsupported item
Implementations§
Source§impl ItemKind
impl ItemKind
Sourcepub fn is_top_level(&self) -> bool
pub fn is_top_level(&self) -> bool
Returns true if this is a top-level item (can appear at module level).
Sourcepub fn is_nested(&self) -> bool
pub fn is_nested(&self) -> bool
Returns true if this is a nested item (appears inside another item).
Sourcepub fn is_variable(&self) -> bool
pub fn is_variable(&self) -> bool
Returns true if this is a variable-level item (local scope).