pub enum PureStmt {
Local {
pattern: PurePattern,
ty: Option<PureType>,
init: Option<PureExpr>,
else_branch: Option<Box<PureExpr>>,
},
Semi(PureExpr),
Expr(PureExpr),
Item(Box<PureItem>),
Verbatim(String),
}Expand description
A statement.
Variants§
Local
Local variable: let x = 1; or let Some(x) = opt else { ... }; (let-else).
Fields
pattern: PurePatternBinding pattern (LHS of let).
Semi(PureExpr)
Expression with semicolon.
Expr(PureExpr)
Expression without semicolon (tail expression).
Item(Box<PureItem>)
Item statement (function inside function, etc.).
Verbatim(String)
Verbatim raw bytes that must survive PureFile::to_source exactly
as authored. Same staging mechanism as PureExpr::Verbatim but at
the statement level: lowered to a unique sentinel
__ryo_verbatim_stmt_<N>; expression-statement stub, then the
post-prettyplease splice step replaces the entire line
containing that identifier with the raw bytes (matching the
item-level splice semantics, because a Stmt occupies its own
line in prettyplease output). Used for raw let x = ...;,
macro invocation stmts (tracing::info!(...);), and other
shapes where the entire stmt — not just the contained expr —
must carry user trivia (B-3-cont).
Implementations§
Source§impl PureStmt
impl PureStmt
Sourcepub fn get_expr(&self) -> Option<&PureExpr>
pub fn get_expr(&self) -> Option<&PureExpr>
Get the expression contained in this statement.
Returns Some for Local (init expr), Semi, and Expr variants.
Returns None for Item or if Local has no initializer.
Sourcepub fn get_expr_mut(&mut self) -> Option<&mut PureExpr>
pub fn get_expr_mut(&mut self) -> Option<&mut PureExpr>
Get mutable expression contained in this statement.