Skip to main content

Library Mode

In addition to the standalone CLI compiler, FlowLog can be embedded directly into Rust projects as a library. Instead of producing a separate binary, library mode compiles Datalog programs into Rust modules at cargo build time and links them into your application.

This is useful when you want to:

  • Embed Datalog computation inside an existing Rust application rather than managing a separate executable.
  • Drive dataflow programmatically — feed data from your own structs, iterate over results in-process, and integrate with your application's error handling.
  • Use cargo as the single build system — no extra CLI invocation or build script coordination.

Library mode is provided by two crates:

CrateRole
flowlog-buildBuild-time compilation of .dl programs into Rust source modules. Added as a build-dependency.
flowlog-runtimeRuntime types and traits used by the generated code. Added as a regular dependency.

Both batch and incremental execution modes are supported.

  • Setup — Add the crates and write a minimal build.rs.
  • Configuration — Tune compilation with the Builder API.