rune/ast/expr_try.rs
1use crate::ast::prelude::*;
2
3#[test]
4#[cfg(not(miri))]
5fn ast_parse() {
6 rt::<ast::ExprTry>("42?");
7 rt::<ast::ExprTry>("foo()?");
8}
9
10/// A try expression.
11///
12/// * `<expr>?`.
13#[derive(Debug, TryClone, PartialEq, Eq, ToTokens, Spanned)]
14#[non_exhaustive]
15pub struct ExprTry {
16 /// Attributes associated with expression.
17 #[rune(iter)]
18 pub attributes: Vec<ast::Attribute>,
19 /// The expression being awaited.
20 pub expr: Box<ast::Expr>,
21 /// The try operator `?`.
22 pub try_token: T![?],
23}
24
25expr_parse!(Try, ExprTry, "try expression");