Formualizer Docs
Reference

Rust API Map

Detailed overview of the Rust crates and core types in the Formualizer workspace.

Formualizer is organized as a modular Rust workspace, allowing users to depend only on the components they need.

Crate Overview

CrateResponsibility
formualizer-parseTokenization, parser, and AST construction.
formualizer-evalFormula evaluation engine, built-in functions, and recalc planning.
formualizer-commonShared types: LiteralValue, ExcelError, RangeAddress.
formualizer-workbookWorkbook state management, sheet orchestration, and evaluation.
formualizer-sheetportSheetPort runtime: sessions, batch execution, and typed I/O.
sheetport-specFIO manifest parsing, validation, and JSON Schema generation.
formualizer-macrosProcedural macros for internal crate optimizations.

Feature Flags

  • wasm_plugins: Enables loading custom functions via WebAssembly modules.
  • wasm_runtime_wasmtime: Uses Wasmtime as the backend for WASM plugins.
  • umya_integration: Provides helpers for integrating with the umya-spreadsheet crate.
  • serde: Enables Serde serialization/deserialization for core types.

Key Types and Methods

Core Values: LiteralValue

The LiteralValue enum represents any value that can exist in a cell or as an intermediate result.

  • Int(i64) / Number(f64)
  • Text(String)
  • Boolean(bool)
  • Array(Vec<Vec<LiteralValue>>)
  • Date(NaiveDate) / DateTime(NaiveDateTime) / Time(NaiveTime)
  • Duration(Duration)
  • Empty / Pending
  • Error(ExcelError)

Error Handling: ExcelErrorKind

Used within ExcelError to categorize calculation failures.

  • Null, Ref, Name, Value, Div, Na, Num, Error, NImpl, Spill, Calc, Circ, Cancelled

Workbook Management

The Workbook type in formualizer-workbook is the central coordinator.

  • add_sheet(name): Create a new sheet.
  • set_value(address, value): Update a cell with a literal.
  • set_formula(address, formula): Update a cell with a formula string.
  • evaluate(address): Trigger evaluation for a specific cell and its dependencies.

SheetPort Runtime

SheetPort and SheetPortSession in formualizer-sheetport provide structured I/O.

  • SheetPortSession::new(manifest, workbook): Initialize a session.
  • session.write_inputs(map): Update multiple inputs at once.
  • session.read_outputs(): Extract computed results based on the manifest.

See Also

On this page