madapes

runtime-function (0.2.1)

Published 2026-02-15 00:39:48 +00:00 by vlad

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add runtime-function@0.2.1

About this package

Pure Function Runtime System - Deterministic DAG-based data transformations

Pure Function Runtime System

runtime-function is a high-performance, deterministic execution engine for DAG-based data transformations. It allows you to define complex logic as JSON-serialized graphs and execute them with built-in safety, gas metering, and zero-copy data passing.

Features

  • Language Support: Native Rust, Node.js (via napi-rs), and Go (via CGO).
  • Deterministic: Same inputs + context always produce identical outputs.
  • Gas Metered: Prevents CPU exhaustion via granular resource limits.
  • Zero-Copy: Uses Arc and CoW for efficient data handling.
  • Financial Grade: 128-bit fixed-point decimal math.

Installation & Usage

Rust

[dependencies]
runtime-function = { git = "https://git.madapes.com/madapes/runtime-function.git" }
use runtime_function::{Engine, Program, Context, Value};

let engine = Engine::new();
let program: Program = serde_json::from_str(json_program)?;
let result = engine.execute(&program, inputs, Context::now());

Node.js

npm install @madapes/runtime-function
import { RuntimeEngine } from '@madapes/runtime-function';

const engine = new RuntimeEngine();
const result = engine.execute(JSON.stringify(program), JSON.stringify(inputs));
console.log(JSON.parse(result));

Go

go get github.com/madapes/runtime-function/bindings/go
import "github.com/madapes/runtime-function/bindings/go"

engine := runtimefunction.NewEngine()
program, _ := runtimefunction.ParseProgram(jsonStr)
result, _ := engine.Execute(program, inputs, nil)

Development

Prerequisites

  • Rust (latest stable)
  • Node.js (v18+)
  • Go (v1.21+)

Building Bindings

# Node.js
cd bindings/nodejs && npm install && npm run build:debug

# Go (requires Rust library build with ffi feature)
cargo build --features ffi
cd bindings/go && go test -v .

License

MIT

Dependencies

ID Version
axum ^0.7
bincode ^1.3
chrono ^0.4
chrono-tz ^0.10
fancy-regex ^0.14
oxc_allocator ^0.44
oxc_ast ^0.44
oxc_parser ^0.44
oxc_span ^0.44
oxc_syntax ^0.44
rand ^0.8
rand_chacha ^0.3
rayon ^1.10
rust_decimal ^1.36
seahash ^4.1
serde ^1.0
serde_json ^1.0
sha2 ^0.10
thiserror ^2.0
tokio ^1.43
tower-http ^0.5
tracing ^0.1
tracing-subscriber ^0.3
uuid ^1.11
criterion ^0.5
pretty_assertions ^1.4
proptest ^1.5
tempfile ^3.14
tower ^0.5

Keywords

runtime pure-function dag deterministic
Details
Cargo
2026-02-15 00:39:48 +00:00
11
MIT
106 KiB
Assets (1)
Versions (4) View all
0.2.6 2026-03-27
0.2.3 2026-02-15
0.2.1 2026-02-15
0.1.3 2026-02-14