pub struct Sum {
pub variable: LitSym,
pub range: Range,
pub body: Box<Expr>,
pub span: Range<usize>,
}Expand description
A sum expression, such as sum n in 1..10 of n.
A sum expression is a shortcut for a loop that represents a summation. The final expression is summed over the specified range, with a specific variable name taking on each value in the range. The above example is equivalent to the following code:
out = 0
for n in 1..10 {
out += n
}
outFields§
§variable: LitSymThe variable name representing each value in the range.
range: RangeThe range of values that the variable will take on.
body: Box<Expr>The body of the summation.
span: Range<usize>The region of the source code that this sum expression was parsed from.
Implementations§
Trait Implementations§
Source§impl Latex for Sum
impl Latex for Sum
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 Sum
impl<'source> Parse<'source> for Sum
impl Eq for Sum
impl StructuralPartialEq for Sum
Auto Trait Implementations§
impl Freeze for Sum
impl RefUnwindSafe for Sum
impl Send for Sum
impl Sync for Sum
impl Unpin for Sum
impl UnwindSafe for Sum
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