Skip to main content

Crate mln_expression

Crate mln_expression 

Source
Expand description

Style expressions: their types and values, parsing, and evaluation.

A parsed expression is an Expr, a closed tree whose nodes the parser has type-checked, so that it evaluates typed (see expression). The expression forms (let, match, interpolate and the others that parse their own arguments) are a closed set of nodes; every other operator is a function, which parsing resolves by name against a Functions value (see functions). Each kind of node has its own module. type, match, let and in are Rust keywords, so those modules are type_, match_, let_ and in_.

Re-exports§

pub use expression::Dependency;
pub use expression::EvaluationContext;
pub use expression::EvaluationError;
pub use expression::EvaluationResult;
pub use expression::Expr;
pub use formatted::Formatted;
pub use formatted::FormattedSection;
pub use functions::Functions;
pub use image::Image;
pub use is_expression::is_expression;
pub use parsing_context::ParseResult;
pub use parsing_context::ParsingContext;
pub use parsing_context::TypeAnnotationOption;
pub use type_::Type;
pub use value::Value;
pub use value::ValueConverter;
pub use value::from_expression_value;

Modules§

case
compound_expression
expression
A parsed, type-checked expression (Expr) and its evaluation.
format_expression
format_section_override
format-section-override: a property’s value that a section of a formatted value can override. The style installs it on a symbol layer’s text-color; it has no style JSON of its own.
formatted
functions
The expression functions: the operators that the parser resolves by name against a Functions value and that evaluate their already-parsed arguments.
image
image_expression
is_expression
match_
parsing_context
range
type_
value

Structs§

Interpolate
["interpolate", interpolation, input, label, output, ...] and its color space variants.
Step
["step", input, output, label, output, ...].
Stops
The stops of a curve: outputs by input key, in key order. The keys are kept apart from the outputs, so that finding a stop reads only keys.

Enums§

Interpolator
Interpolator: variant<ExponentialInterpolator, CubicBezierInterpolator>.
ZoomCurvePtr
The zoom curve of an expression: none, an interpolate or a step.

Functions§

feature_property_keys
The property keys expression reads, sorted and without duplicates, if they and the geometry type are all it reads of a feature: not its id, its geometry, its feature state, all its properties or a key it computes. The expression then gives features with the same geometry type and the same values under those keys the same result.
find_zoom_curve_checked
Find a zoom curve in the expression tree: the relevant step or interpolate item, or null if the expression represents an error, which is logged.