Enum EntryMut
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§
§impl EntryMut<'_>
impl EntryMut<'_>
pub 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.
pub 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.
pub 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.
pub fn is_statement(&self) -> bool
pub fn is_statement(&self) -> bool
Returns true if this entry holds a statement expression.
pub fn is_value_null(&self) -> bool
pub fn is_value_null(&self) -> bool
Returns true if this entry holds a null value.
pub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true if this entry is Expr::Default.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for EntryMut<'a>
impl<'a> RefUnwindSafe for EntryMut<'a>
impl<'a> Send for EntryMut<'a>
impl<'a> Sync for EntryMut<'a>
impl<'a> Unpin for EntryMut<'a>
impl<'a> !UnwindSafe for EntryMut<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more