Crate rustledger_wasm

Crate rustledger_wasm 

Source
Expand description

Beancount WASM Bindings.

This crate provides WebAssembly bindings for using Beancount from JavaScript/TypeScript.

§Features

  • Parse Beancount files
  • Validate ledgers
  • Run BQL queries
  • Format directives

§Example (JavaScript)

import init, { parse, validateSource, query } from '@rustledger/wasm';

await init();

const source = `
2024-01-01 open Assets:Bank USD
2024-01-15 * "Coffee"
  Expenses:Food  5.00 USD
  Assets:Bank   -5.00 USD
`;

const result = parse(source);
if (result.errors.length === 0) {
    const validation = validateSource(source);
    console.log('Validation errors:', validation.errors);
}

Modules§

types
Data transfer objects for WASM serialization.

Structs§

ParsedLedger
A parsed and validated ledger that caches the parse result.

Functions§

balances
Calculate account balances.
bql_completions
Get BQL query completions at cursor position.
expand_pads
Process pad directives and expand them.
format
Format a Beancount source string.
init
Initialize the WASM module.
list_plugins
List available native plugins.
parse
Parse a Beancount source string.
query
Run a BQL query on a Beancount source string.
run_plugin
Run a native plugin on the source.
validate_source
Validate a Beancount source string.
version
Get version information.