pub struct Product {
pub variable: LitSym,
pub range: Range,
pub body: Box<Expr>,
pub span: Range<usize>,
}Expand description
A product expression, such as product n in 1..10 of n.
A product expression is a shortcut for a loop that represents an accumulative product. The final expression is multiplied 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 = 1
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 product.
span: Range<usize>The region of the source code that this product expression was parsed from.
Implementations§
Trait Implementations§
Source§impl Latex for Product
impl Latex for Product
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 Product
impl<'source> Parse<'source> for Product
impl Eq for Product
impl StructuralPartialEq for Product
Auto Trait Implementations§
impl Freeze for Product
impl RefUnwindSafe for Product
impl Send for Product
impl Sync for Product
impl Unpin for Product
impl UnwindSafe for Product
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