toasty_core/stmt/
expr_stmt.rs1use super::{Expr, Insert, Statement};
2
3#[derive(Debug, Clone, PartialEq)]
14pub struct ExprStmt {
15 pub stmt: Box<Statement>,
17}
18
19impl Expr {
20 pub fn stmt(stmt: impl Into<Statement>) -> Self {
21 Self::Stmt(ExprStmt {
22 stmt: Box::new(stmt.into()),
23 })
24 }
25}
26
27impl From<ExprStmt> for Expr {
28 fn from(value: ExprStmt) -> Self {
29 Self::Stmt(value)
30 }
31}
32
33impl From<Statement> for ExprStmt {
34 fn from(value: Statement) -> Self {
35 Self { stmt: value.into() }
36 }
37}
38
39impl From<Insert> for ExprStmt {
40 fn from(value: Insert) -> Self {
41 Self {
42 stmt: Box::new(Statement::from(value)),
43 }
44 }
45}
46
47impl From<Insert> for Expr {
48 fn from(value: Insert) -> Self {
49 Self::Stmt(value.into())
50 }
51}