pub enum Expression {
Column(ColumnName),
Number(NumberLiteral),
Negate(Box<Expression>),
Binary {
op: BinaryOp,
left: Box<Expression>,
right: Box<Expression>,
},
}Expand description
Arithmetic over the columns of one table, evaluated per row.
Variants§
Column(ColumnName)
A column of the table.
Number(NumberLiteral)
A numeric literal.
Negate(Box<Expression>)
Unary minus.
Binary
left op right.
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn parse(input: &str) -> Result<Self, ExpressionError>
pub fn parse(input: &str) -> Result<Self, ExpressionError>
Parse input. A lone column name gives Expression::Column.
Sourcepub fn as_column(&self) -> Option<&ColumnName>
pub fn as_column(&self) -> Option<&ColumnName>
The column, when the expression is a plain column.
Sourcepub fn columns(&self) -> Vec<&ColumnName>
pub fn columns(&self) -> Vec<&ColumnName>
Every column the expression reads, once each, in order of appearance.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§impl Debug for Expression
impl Debug for Expression
Source§impl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for Expression
The canonical text: single spaces around binary operators, and parentheses
only where the tree needs them (a right operand at the same precedence keeps
them, since the operators associate left). A negated negation is - -a:
the space keeps -- out of the text, and no parentheses means the text
nests no deeper than the tree is tall, so every parsed tree renders to text
the parser accepts.
impl Display for Expression
The canonical text: single spaces around binary operators, and parentheses
only where the tree needs them (a right operand at the same precedence keeps
them, since the operators associate left). A negated negation is - -a:
the space keeps -- out of the text, and no parentheses means the text
nests no deeper than the tree is tall, so every parsed tree renders to text
the parser accepts.
impl Eq for Expression
Source§impl From<ColumnName> for Expression
impl From<ColumnName> for Expression
Source§fn from(column: ColumnName) -> Self
fn from(column: ColumnName) -> Self
Source§impl FromStr for Expression
impl FromStr for Expression
Source§impl Hash for Expression
A plain column hashes as the ColumnName it is, so an aggregate written
before expressions keeps its content hash. Anything else hashes its
canonical text, which is never a column name: it holds an operator, or is
a number, and a column name never starts with a digit.
impl Hash for Expression
A plain column hashes as the ColumnName it is, so an aggregate written
before expressions keeps its content hash. Anything else hashes its
canonical text, which is never a column name: it holds an operator, or is
a number, and a column name never starts with a digit.
Source§impl PartialEq for Expression
impl PartialEq for Expression
Source§impl Serialize for Expression
impl Serialize for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Forget for Expression
impl Freeze for Expression
impl Move for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnsafeUnpin for Expression
impl UnwindSafe for Expression
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.