#[non_exhaustive]pub enum NodeKind {
Show 74 variants
Module {
path: Option<ModulePath>,
annotations: Vec<Annotation>,
imports: Vec<AIRNode>,
items: Vec<AIRNode>,
},
ImportDecl {
path: ModulePath,
items: ImportItems,
},
FnDecl {
annotations: Vec<Annotation>,
visibility: Visibility,
is_async: bool,
name: Ident,
generic_params: Vec<GenericParam>,
params: Vec<AIRNode>,
return_type: Option<Box<AIRNode>>,
effect_clause: Vec<TypePath>,
where_clause: Vec<TypeConstraint>,
body: Box<AIRNode>,
},
RecordDecl {
annotations: Vec<Annotation>,
visibility: Visibility,
name: Ident,
generic_params: Vec<GenericParam>,
fields: Vec<RecordDeclField>,
},
EnumDecl {
annotations: Vec<Annotation>,
visibility: Visibility,
name: Ident,
generic_params: Vec<GenericParam>,
variants: Vec<AIRNode>,
},
EnumVariant {
name: Ident,
payload: EnumVariantPayload,
},
ClassDecl {
annotations: Vec<Annotation>,
visibility: Visibility,
name: Ident,
generic_params: Vec<GenericParam>,
base: Option<TypePath>,
traits: Vec<TypePath>,
fields: Vec<RecordDeclField>,
methods: Vec<AIRNode>,
},
TraitDecl {
annotations: Vec<Annotation>,
visibility: Visibility,
is_platform: bool,
name: Ident,
generic_params: Vec<GenericParam>,
associated_types: Vec<AssociatedType>,
methods: Vec<AIRNode>,
},
ImplBlock {
annotations: Vec<Annotation>,
generic_params: Vec<GenericParam>,
trait_path: Option<TypePath>,
target: Box<AIRNode>,
where_clause: Vec<TypeConstraint>,
methods: Vec<AIRNode>,
},
EffectDecl {
annotations: Vec<Annotation>,
visibility: Visibility,
name: Ident,
generic_params: Vec<GenericParam>,
components: Vec<TypePath>,
operations: Vec<AIRNode>,
},
TypeAlias {
annotations: Vec<Annotation>,
visibility: Visibility,
name: Ident,
generic_params: Vec<GenericParam>,
ty: Box<AIRNode>,
where_clause: Vec<TypeConstraint>,
},
ConstDecl {
annotations: Vec<Annotation>,
visibility: Visibility,
name: Ident,
ty: Box<AIRNode>,
value: Box<AIRNode>,
},
ModuleHandle {
effect: TypePath,
handler: Box<AIRNode>,
},
PropertyTest {
name: String,
bindings: Vec<PropertyBinding>,
body: Box<AIRNode>,
},
Param {
pattern: Box<AIRNode>,
ty: Option<Box<AIRNode>>,
default: Option<Box<AIRNode>>,
},
TypeNamed {
path: TypePath,
args: Vec<AIRNode>,
},
TypeTuple {
elems: Vec<AIRNode>,
},
TypeFunction {
params: Vec<AIRNode>,
ret: Box<AIRNode>,
effects: Vec<TypePath>,
},
TypeOptional {
inner: Box<AIRNode>,
},
TypeSelf,
Literal {
lit: Literal,
},
Identifier {
name: Ident,
},
BinaryOp {
op: BinOp,
left: Box<AIRNode>,
right: Box<AIRNode>,
},
UnaryOp {
op: UnaryOp,
operand: Box<AIRNode>,
},
Assign {
op: AssignOp,
target: Box<AIRNode>,
value: Box<AIRNode>,
},
Call {
callee: Box<AIRNode>,
args: Vec<AirArg>,
type_args: Vec<AIRNode>,
},
MethodCall {
receiver: Box<AIRNode>,
method: Ident,
type_args: Vec<AIRNode>,
args: Vec<AirArg>,
},
FieldAccess {
object: Box<AIRNode>,
field: Ident,
},
Index {
object: Box<AIRNode>,
index: Box<AIRNode>,
},
Propagate {
expr: Box<AIRNode>,
},
Lambda {
params: Vec<AIRNode>,
body: Box<AIRNode>,
},
Pipe {
left: Box<AIRNode>,
right: Box<AIRNode>,
},
Compose {
left: Box<AIRNode>,
right: Box<AIRNode>,
},
Await {
expr: Box<AIRNode>,
},
Range {
lo: Box<AIRNode>,
hi: Box<AIRNode>,
inclusive: bool,
},
RecordConstruct {
path: TypePath,
fields: Vec<AirRecordField>,
spread: Option<Box<AIRNode>>,
},
ListLiteral {
elems: Vec<AIRNode>,
},
MapLiteral {
entries: Vec<AirMapEntry>,
},
SetLiteral {
elems: Vec<AIRNode>,
},
TupleLiteral {
elems: Vec<AIRNode>,
},
Interpolation {
parts: Vec<AirInterpolationPart>,
},
Placeholder,
Unreachable,
ResultConstruct {
variant: ResultVariant,
value: Option<Box<AIRNode>>,
},
If {
let_pattern: Option<Box<AIRNode>>,
condition: Box<AIRNode>,
then_block: Box<AIRNode>,
else_block: Option<Box<AIRNode>>,
},
Guard {
let_pattern: Option<Box<AIRNode>>,
condition: Box<AIRNode>,
else_block: Box<AIRNode>,
},
Match {
scrutinee: Box<AIRNode>,
arms: Vec<AIRNode>,
},
MatchArm {
pattern: Box<AIRNode>,
guard: Option<Box<AIRNode>>,
body: Box<AIRNode>,
},
For {
pattern: Box<AIRNode>,
iterable: Box<AIRNode>,
body: Box<AIRNode>,
},
While {
condition: Box<AIRNode>,
body: Box<AIRNode>,
},
Loop {
body: Box<AIRNode>,
},
Block {
stmts: Vec<AIRNode>,
tail: Option<Box<AIRNode>>,
},
Return {
value: Option<Box<AIRNode>>,
},
Break {
value: Option<Box<AIRNode>>,
},
Continue,
LetBinding {
is_mut: bool,
pattern: Box<AIRNode>,
ty: Option<Box<AIRNode>>,
value: Box<AIRNode>,
},
Move {
expr: Box<AIRNode>,
},
Borrow {
expr: Box<AIRNode>,
},
MutableBorrow {
expr: Box<AIRNode>,
},
EffectOp {
effect: TypePath,
operation: Ident,
args: Vec<AirArg>,
},
HandlingBlock {
handlers: Vec<AirHandlerPair>,
body: Box<AIRNode>,
},
EffectRef {
path: TypePath,
},
WildcardPat,
BindPat {
name: Ident,
is_mut: bool,
},
LiteralPat {
lit: Literal,
},
ConstructorPat {
path: TypePath,
fields: Vec<AIRNode>,
},
RecordPat {
path: TypePath,
fields: Vec<AirRecordPatternField>,
rest: bool,
},
TuplePat {
elems: Vec<AIRNode>,
},
ListPat {
elems: Vec<AIRNode>,
rest: Option<Box<AIRNode>>,
},
OrPat {
alternatives: Vec<AIRNode>,
},
GuardPat {
pattern: Box<AIRNode>,
guard: Box<AIRNode>,
},
RangePat {
lo: Box<AIRNode>,
hi: Box<AIRNode>,
inclusive: bool,
},
RestPat,
Error,
}Expand description
Discriminant and typed children of an AIRNode.
Children are structured per variant (not a flat Vec<AIRNode>), mirroring
the AST but lowered into the unified AIR representation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Module
The root node of a compiled Bock source file.
Fields
path: Option<ModulePath>annotations: Vec<Annotation>Module-level annotations (@context, @requires, etc.).
ImportDecl
An import declaration: import Foo.Bar.{ A, B }.
FnDecl
A function declaration.
Fields
annotations: Vec<Annotation>visibility: Visibilitygeneric_params: Vec<GenericParam>where_clause: Vec<TypeConstraint>RecordDecl
A record (value-type) declaration.
Fields
annotations: Vec<Annotation>visibility: Visibilitygeneric_params: Vec<GenericParam>fields: Vec<RecordDeclField>EnumDecl
An enum (algebraic data type) declaration.
EnumVariant
An enum variant — unit, struct-like, or tuple-like.
Fields
payload: EnumVariantPayloadNone = unit; Some = struct fields or positional types.
ClassDecl
A class declaration.
Fields
annotations: Vec<Annotation>visibility: Visibilitygeneric_params: Vec<GenericParam>fields: Vec<RecordDeclField>TraitDecl
A trait (or platform-trait) declaration.
Fields
annotations: Vec<Annotation>visibility: Visibilitygeneric_params: Vec<GenericParam>associated_types: Vec<AssociatedType>ImplBlock
An impl Trait for Type or impl Type block.
Fields
annotations: Vec<Annotation>generic_params: Vec<GenericParam>where_clause: Vec<TypeConstraint>EffectDecl
An algebraic effect declaration.
TypeAlias
A type alias: type Name[T] = ....
Fields
annotations: Vec<Annotation>visibility: Visibilitygeneric_params: Vec<GenericParam>where_clause: Vec<TypeConstraint>ConstDecl
A constant declaration: const NAME: Type = value.
ModuleHandle
A module-level handle Effect with handler declaration.
PropertyTest
A property("name") { forall(...) { ... } } property-based test.
Fields
bindings: Vec<PropertyBinding>Param
A single function/lambda parameter.
Fields
TypeNamed
A named type, possibly with generic arguments: List[Int].
TypeTuple
A tuple type: (Int, String).
TypeFunction
A function type: Fn(Int) -> String with Log.
Fields
TypeOptional
An optional type: Int?.
TypeSelf
The Self type in a trait/impl context.
Literal
A literal value.
Identifier
An identifier reference.
BinaryOp
A binary operation: a + b.
UnaryOp
A unary operation: -x, !flag.
Assign
An assignment expression: x = 5, x += 1.
Call
A function call: f(a, b).
MethodCall
A method call: obj.method(a, b).
FieldAccess
Field access: obj.field.
Index
Index access: arr[i].
Propagate
Error propagation: expr? — maps to spec’s Propagate.
Lambda
A lambda: (x) => x * 2.
Fields
Pipe
Pipe operator: data |> parse.
Compose
Function composition: parse >> validate.
Await
An await expression.
Range
A range: 1..10 (exclusive) or 1..=10 (inclusive).
RecordConstruct
Record construction: User { id: 1, name, ..defaults }.
ListLiteral
List literal: [1, 2, 3].
MapLiteral
Map literal: {"key": value}.
Fields
entries: Vec<AirMapEntry>SetLiteral
Set literal: #{"a", "b"}.
TupleLiteral
Tuple literal: ("hello", 42).
Interpolation
String interpolation: "Hello, ${name}!".
Fields
parts: Vec<AirInterpolationPart>Placeholder
A placeholder _ used in pipe expressions.
Unreachable
unreachable — a diverging expression.
ResultConstruct
Explicit Ok(v) or Err(e) result construction.
If
An if / if-let expression.
Fields
Guard
A guard condition else { ... } statement.
When let_pattern is Some, this is guard (let pat = expr) else { ... }.
Fields
Match
A match expression.
MatchArm
One arm of a match expression.
Fields
For
A for loop.
Fields
While
A while loop.
Loop
An infinite loop.
Block
A block of statements with an optional tail expression.
Return
A return expression.
Break
A break expression, optionally with a value.
Continue
A continue expression.
LetBinding
A let [mut] pattern [: Type] = value binding.
Move
An explicit move of ownership: move expr.
Borrow
An immutable borrow: &expr.
MutableBorrow
A mutable borrow: &mut expr.
EffectOp
An algebraic-effect operation invocation.
HandlingBlock
A handling (Effect with handler, ...) { body } block.
EffectRef
A reference to an effect type (used in type positions and signatures).
WildcardPat
_ — wildcard pattern, matches anything.
BindPat
name or mut name — bind pattern.
LiteralPat
A literal pattern: 42, "hello", true.
ConstructorPat
An enum constructor pattern: Some(x), Ok(v).
RecordPat
A record pattern: User { name, age }.
Fields
fields: Vec<AirRecordPatternField>TuplePat
A tuple pattern: (a, b, c).
ListPat
A list pattern: [head, ..tail].
OrPat
An or-pattern: A | B.
GuardPat
A guard pattern (in pattern-matching guard position).
RangePat
A range pattern: 1..10 or 1..=10.
RestPat
A rest pattern .. (inside list/tuple patterns).
Error
An error-recovery node wrapping tokens that could not be lowered.
Trait Implementations§
impl StructuralPartialEq for NodeKind
Auto Trait Implementations§
impl Freeze for NodeKind
impl RefUnwindSafe for NodeKind
impl Send for NodeKind
impl Sync for NodeKind
impl Unpin for NodeKind
impl UnsafeUnpin for NodeKind
impl UnwindSafe for NodeKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);