pub struct Expression {
    pub kind: ExpressionKind,
    pub id: NodeId,
    pub span: Span,
}
Expand description

The Ast representation of a stream expression

Fields§

§kind: ExpressionKind

The kind of the root expression, e.g., stream access

§id: NodeId

The id of the node in the Ast

§span: Span

The span in the specification declaring the extend declaration

Implementations§

Parses an expression into a duration for a discrete window ExpressionKind::DiscreteWindowAggregation

Parses an expression into a frequency. Expression must be a positive numeric value with Hz unit.

Examples found in repository?
src/ast/conversion.rs (line 147)
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
    pub fn parse_freqspec(&self) -> Result<UOM_Frequency, String> {
        if let Ok(freq) = self.parse_frequency() {
            Ok(freq)
        } else if let Ok(period) = self.parse_duration() {
            let seconds = period.get::<second>();
            if seconds.is_positive() {
                Ok(UOM_Frequency::new::<hertz>(seconds.inv()))
            } else {
                Err(format!(
                    "duration of periodic stream specification must be positive, found `{:#?}`",
                    period
                ))
            }
        } else {
            Err(format!("expected frequency or duration, found `{}`", self))
        }
    }

Parses a frequency annotation. Expression must either be a frequency or a duration representing the period

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.