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 {
23 Self::Stmt(ExprStmt {
24 stmt: Box::new(stmt.into()),
25 })
26 }
27}
28
29impl From<ExprStmt> for Expr {
30 fn from(value: ExprStmt) -> Self {
31 Self::Stmt(value)
32 }
33}
34
35impl From<Statement> for ExprStmt {
36 fn from(value: Statement) -> Self {
37 Self { stmt: value.into() }
38 }
39}
40
41impl From<Insert> for ExprStmt {
42 fn from(value: Insert) -> Self {
43 Self {
44 stmt: Box::new(Statement::from(value)),
45 }
46 }
47}
48
49impl From<Insert> for Expr {
50 fn from(value: Insert) -> Self {
51 Self::Stmt(value.into())
52 }
53}