Expand description
Typed expression engine for data-driven style evaluation.
Expression<T> is the core type used by the style system to represent
values that may depend on zoom level, feature properties, feature state,
or combinations thereof.
§Design
Rather than interpreting JSON expression arrays at runtime (the MapLibre approach, motivated by JavaScript’s lack of a type system), Rustial uses a typed enum AST that is:
- Compile-time checked — invalid expressions cannot be constructed.
- Zero-cost for constants —
Expression::Constant(v)is a plain value. - Branch-predictor friendly — evaluation is a single
matchdispatch. - Rust-ergonomic — users build expressions with constructors, not JSON.
JSON-based style documents (MapLibre/Mapbox .json) are parsed into
Expression<T> by the style-json feature’s deserialiser, making JSON
an input format rather than the core representation.
§Backward compatibility
[StyleValue<T>] is a type alias for Expression<T>, preserving all
existing API call-sites.
Structs§
- Expr
Eval Context - Full evaluation context for expressions.
Enums§
- Bool
Expression - A boolean expression that evaluates to
bool. - Expression
- A typed expression that evaluates to a value of type
T. - Numeric
Expression - A numeric expression that evaluates to
f64. - String
Expression - A string expression that evaluates to a
String.
Type Aliases§
- Feature
Properties - Properties of a single feature being styled.