Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Tuple and Tuple Indexing Expressions

This section is a work-in-progress experiment about making the book executable.

Syntax
TupleExpression: ( elements=TupleElements? )
    => elements.unwrap_or_default()
TupleElements: elements=( Expression , )+ last=Expression?
    => elements.into_iter().chain(last).collect()
TupleIndexingExpression: expression=Expression . index=TupleIndex#[prec = `.`]
    => TupleIndexingExpression { expression: Box::new(expression), index }
TupleIndex: index=INTEGER_LITERAL => usize::try_from(index).unwrap()

pub struct TupleIndexingExpression {
    pub expression: Box<Expression>,
    pub index: usize,
}