Skip to main content

Module eval

Module eval 

Source
Expand description

Formula evaluation engine.

Evaluates parsed formula ASTs against cell data provided through the CellDataProvider trait. Supports arithmetic, comparison, string concatenation, cell/range references, and built-in function calls.

Structs§

CellCoord
A cell coordinate used as a node in the dependency graph.
CellSnapshot
In-memory snapshot of cell data, decoupled from any Workbook borrow.
Evaluator
Stateful evaluator that tracks recursion depth and circular references.

Traits§

CellDataProvider
Provides cell data for formula evaluation.

Functions§

build_dependency_graph
Build a dependency graph from formula cells. Returns a map from each formula cell to the cells it depends on.
coerce_to_bool
Coerce a CellValue to a boolean. Numbers: 0 is false, nonzero is true. Strings “TRUE”/“FALSE” are recognized. Empty is false.
coerce_to_number
Coerce a CellValue to f64. Booleans become 0/1, empty becomes 0, numeric strings are parsed. Non-numeric strings yield an error.
coerce_to_string
Coerce a CellValue to a string.
compare_values
Compare two CellValues for ordering. Uses Excel comparison semantics: numbers compare numerically, strings compare case-insensitively, mixed types rank as: empty < number < string < bool.
evaluate
Evaluate a parsed formula expression against the given cell data provider.
topological_sort
Topological sort of formula cells based on dependencies. Returns cells in evaluation order (dependencies first). Detects cycles and returns an error if found.