[][src]Enum prometheus_parser::Expression

pub enum Expression {
    Float(f64),
    String(String),
    Selector(Selector),
    Group(Group),
    Function(Function),
    Operator(Operator),
}

A root expression node.

These are all valid root expression types.

Variants

Float(f64)

A single scalar float

String(String)

A single scalar string.

Prometheus' docs claim strings aren't currently implemented, but they're valid as function arguments.

Selector(Selector)

A metric selector

Group(Group)

A grouped expression wrapped in parentheses

Function(Function)

A function call

Operator(Operator)

A binary operator expression

Methods

impl Expression[src]

pub fn group(self) -> Expression[src]

Wraps this Expression in a Group, consuming this Expression but returning an owned Group.

pub fn return_value(&self) -> ReturnValue[src]

Determines a predicted ReturnValue for this Expression. A ReturnValue includes a predicted data type and a set of label operations that may affect which labels are returned.

pub fn as_f64(&self) -> Option<f64>[src]

If this Expression is a Float, returns its value. Otherwise, returns None.

pub fn as_str(&self) -> Option<&str>[src]

If this Expression is a String, returns its value. Otherwise, returns None.

Trait Implementations

impl Clone for Expression[src]

impl Debug for Expression[src]

impl Display for Expression[src]

impl PartialEq<Expression> for Expression[src]

impl StructuralPartialEq for Expression[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.