Skip to main content

Crate phop_wasm

Crate phop_wasm 

Source
Expand description

§phop-wasm — WebAssembly bindings for phop

Exposes the phop-core discovery engine to JavaScript via wasm-bindgen. The single entry point discover_json takes JSON-encoded data and configuration, runs discovery, and returns a JSON-encoded Pareto front, making it trivial to call from a browser without any custom marshalling.

import init, { discover_json, set_panic_hook } from "./pkg/phop_wasm.js";
await init();
set_panic_hook();
const data = JSON.stringify({ x: [[1],[2],[3]], y: [2,4,6] });
const cfg  = JSON.stringify({ population: 64, max_epochs: 50, seed: 0 });
const out  = JSON.parse(discover_json(data, cfg));
console.log(out.solutions);

Functions§

capabilities
Report which verification tiers this wasm build supports — lets the UI light up only what is actually available (e.g. hide the SMT panel when built without smt).
discover_and_verify
Run the full discover→verify pipeline from JSON, entirely in-browser.
discover_json
Run symbolic discovery from JSON.
set_panic_hook
Install console_error_panic_hook so Rust panics surface as readable console.error messages in the browser.