pub enum Expr {
Number(f64),
String(String),
VectorSelector(VectorSelector),
MatrixSelector(MatrixSelector),
Call(Call),
Aggregation(Box<Aggregation>),
Binary(Box<BinaryExpr>),
Unary(Box<UnaryExpr>),
Paren(Box<Expr>),
Subquery(Box<SubqueryExpr>),
}Expand description
Root expression type for PromQL AST
Variants§
Number(f64)
Numeric literal: 42, 3.14, 0x1F, 1e-10, Inf, NaN
String(String)
String literal: "hello", 'world', `raw`
VectorSelector(VectorSelector)
Instant vector selector: http_requests{job="api"}
MatrixSelector(MatrixSelector)
Range vector selector: http_requests{job="api"}[5m]
Call(Call)
Function call: rate(http_requests[5m])
Aggregation(Box<Aggregation>)
Aggregation: sum by (job) (http_requests)
Binary(Box<BinaryExpr>)
Binary operation: foo + bar, foo / on(job) bar
Unary(Box<UnaryExpr>)
Unary operation: -foo, +bar
Paren(Box<Expr>)
Parenthesized: (foo + bar)
Subquery(Box<SubqueryExpr>)
Subquery: rate(http_requests[5m])[30m:1m]
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn is_instant_vector(&self) -> bool
pub fn is_instant_vector(&self) -> bool
Check if this expression produces an instant vector
Sourcepub fn is_range_vector(&self) -> bool
pub fn is_range_vector(&self) -> bool
Check if this expression produces a range vector
Sourcepub fn unwrap_parens(&self) -> &Expr
pub fn unwrap_parens(&self) -> &Expr
Unwrap parentheses to get the inner expression
Trait Implementations§
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
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