pub type StyleValue<T> = Expression<T>;Expand description
Type alias for backward compatibility.
StyleValue<T> is now an alias for [Expression<T>], the typed
expression engine. All existing StyleValue::Constant(...),
StyleValue::ZoomStops(...), and StyleValue::FeatureState { .. }
constructions continue to work unchanged.
New code should prefer importing [Expression] directly and using
the richer expression variants (GetProperty, Interpolate, Step,
Match, Case, etc.) for data-driven styling.
Aliased Type§
pub enum StyleValue<T> {
Constant(T),
ZoomStops(Vec<(f32, T)>),
FeatureState {
key: String,
fallback: T,
},
GetProperty {
key: String,
fallback: T,
},
Interpolate {
input: Box<NumericExpression>,
stops: Vec<(f32, T)>,
},
Step {
input: Box<NumericExpression>,
default: T,
stops: Vec<(f32, T)>,
},
Match {
input: Box<StringExpression>,
cases: Vec<(String, T)>,
fallback: T,
},
Case {
branches: Vec<(BoolExpression, T)>,
fallback: T,
},
Coalesce(Vec<Expression<T>>),
}Variants§
Constant(T)
Constant literal value.
ZoomStops(Vec<(f32, T)>)
Zoom-keyed stops with linear interpolation.
FeatureState
Value driven by a per-feature state key.
Fields
fallback: TDefault value when the key is absent.
GetProperty
Read a feature property and convert to T.
Equivalent to MapLibre ["get", "property_name"].
Falls back to fallback when the property is missing or
cannot be converted to T.
Fields
fallback: TValue to use when the property is absent or incompatible.
Interpolate
Interpolate between stops based on a numeric input expression.
Equivalent to MapLibre ["interpolate", ["linear"], input, z0, v0, z1, v1, ...].
Fields
input: Box<NumericExpression>The numeric input value (typically Expression::Zoom or a property).
Step
Step function: returns the stop value for the greatest stop ≤ input.
Equivalent to MapLibre ["step", input, default, z0, v0, z1, v1, ...].
Fields
input: Box<NumericExpression>The numeric input.
default: TDefault value when input is below all stops.
Match
Pattern match on a string input expression.
Equivalent to MapLibre ["match", input, label1, val1, ..., fallback].
Fields
input: Box<StringExpression>The string input to match against.
fallback: TValue when no case matches.
Case
Conditional branches evaluated in order.
Equivalent to MapLibre ["case", cond1, val1, cond2, val2, ..., fallback].
Fields
branches: Vec<(BoolExpression, T)>Branches: (condition, output_value).
fallback: TValue when no condition is true.
Coalesce(Vec<Expression<T>>)
Return the first non-null result from a list of expressions.
Equivalent to MapLibre ["coalesce", expr1, expr2, ...].