pub enum EntryMut<'a> {
Expr(&'a mut Expr),
Value(&'a mut Value),
}Expand description
A mutable reference to either an Expr or a Value within a
composite structure.
This is the mutable counterpart to Entry, used for
in-place modification of nested expressions or values.
§Examples
use toasty_core::stmt::{EntryMut, Expr, Value};
let mut expr = Expr::from(Value::from(42_i64));
let mut entry = EntryMut::from(&mut expr);
assert!(entry.is_expr());Variants§
Expr(&'a mut Expr)
A mutable reference to an expression.
Value(&'a mut Value)
A mutable reference to a value.
Implementations§
Source§impl EntryMut<'_>
impl EntryMut<'_>
Sourcepub fn as_expr(&self) -> Option<&Expr>
pub fn as_expr(&self) -> Option<&Expr>
Returns a reference to the contained expression, or None.
Sourcepub fn as_expr_unwrap(&self) -> &Expr
pub fn as_expr_unwrap(&self) -> &Expr
Returns a reference to the contained expression, panicking if not an expression.
§Panics
Panics if this entry is not EntryMut::Expr.
Sourcepub fn as_expr_mut(&mut self) -> Option<&mut Expr>
pub fn as_expr_mut(&mut self) -> Option<&mut Expr>
Returns a mutable reference to the contained expression, or None.
Sourcepub fn as_expr_mut_unwrap(&mut self) -> &mut Expr
pub fn as_expr_mut_unwrap(&mut self) -> &mut Expr
Returns a mutable reference to the contained expression, panicking if not an expression.
§Panics
Panics if this entry is not EntryMut::Expr.
Sourcepub fn is_statement(&self) -> bool
pub fn is_statement(&self) -> bool
Returns true if this entry holds a statement expression.
Sourcepub fn is_value_null(&self) -> bool
pub fn is_value_null(&self) -> bool
Returns true if this entry holds a null value.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true if this entry is Expr::Default.