pub struct Stmt {
pub expr: Expr,
pub semicolon: Option<Range<usize>>,
pub span: Range<usize>,
}Expand description
Represents a statement in CalcScript.
A statement is the building block of all CalcScript programs. A complete program is a sequence of one or more statements that are executed in order, and returns the value of the last statement. A statement’s return value can be discarded by adding a semicolon at the end of the statement.
Fields§
§expr: ExprThe expression of a statement.
semicolon: Option<Range<usize>>The span of the semicolon that terminates the statement, if any.
When this is None, the statement is an expression, and will return the value of the
expression. Otherwise, the expression is evaluated for side effects, and the statement
returns the unit type ().
span: Range<usize>The region of the source code that this statement was parsed from.
Implementations§
Trait Implementations§
Source§impl Latex for Stmt
impl Latex for Stmt
Source§fn as_display(&self) -> LatexFormatter<'_, Self>
fn as_display(&self) -> LatexFormatter<'_, Self>
Wraps the value in a
LatexFormatter, which implements Display.Source§impl<'source> Parse<'source> for Stmt
impl<'source> Parse<'source> for Stmt
impl Eq for Stmt
impl StructuralPartialEq for Stmt
Auto Trait Implementations§
impl Freeze for Stmt
impl RefUnwindSafe for Stmt
impl Send for Stmt
impl Sync for Stmt
impl Unpin for Stmt
impl UnwindSafe for Stmt
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