rune/ast/expr_assign.rs
1use crate::ast::prelude::*;
2
3#[test]
4#[cfg(not(miri))]
5fn ast_parse() {
6 rt::<ast::ExprAssign>("a = 2");
7 rt::<ast::ExprAssign>("a = b = 3");
8}
9
10/// An assign expression.
11///
12/// * `a = b`.
13#[derive(Debug, TryClone, PartialEq, Eq, ToTokens, Spanned)]
14#[non_exhaustive]
15pub struct ExprAssign {
16 /// Attributes associated with the assign expression.
17 #[rune(iter)]
18 pub attributes: Vec<ast::Attribute>,
19 /// The expression being assigned to.
20 pub lhs: Box<ast::Expr>,
21 /// The equals sign `=`.
22 pub eq: T![=],
23 /// The value.
24 pub rhs: Box<ast::Expr>,
25}
26
27expr_parse!(Assign, ExprAssign, "assign expression");