cbqn

Crates.iocbqn
lib.rscbqn
version0.2.1
sourcesrc
created_at2023-01-28 16:12:59.582676
updated_at2024-12-08 15:52:36.770049
descriptionEmbed BQN in Rust via CBQN FFI
homepagehttps://github.com/Detegr/cbqn-rs
repositoryhttps://github.com/Detegr/cbqn-rs.git
max_upload_size
id770435
size3,013,468
Antti Keränen (Detegr)

documentation

https://detegr.github.io/cbqn-rs/cbqn

README

cbqn

A Rust crate for running BQN code within a Rust program using CBQN interpreter shared object or WASI reactor.

Building

Native backend (libcbqn.so)

With the native backend (default), please make sure the libcbqn shared object can be found by rustc. Build libcbqn.so with make shared-o3 in CBQN repository and set up .cargo/config.toml as following:

[build]
rustflags = "-L/path/to/CBQN"
rustdocflags = "-L/path/to/CBQN"

To make the executable aware of libcbqn.so, if no global install is available for you, you can use LD_LIBRARY_PATH to tell where to load libcbqn.so from:

LD_LIBRARY_PATH=/path/to/CBQN cargo test

WASI backend (BQN.wasm)

To build the WASI backend, point the BQN_WASM environment variable to the BQN.wasm file built with make wasi-reactor-o3 CBQN makefile target. Disable default features and use wasi-backend feature. For example running the tests for this crate:

BQN_WASM=/path/to/CBQN/BQN.wasm cargo test --no-default-features --features=wasi-backend --release

Usage

The documentation contains multiple examples on how to use the crate.

License

Licensed either under GPLv3, LGPLv3 or MPL 2.0 following the licensing of CBQN.

Commit count: 78

cargo fmt