gaesup-state-core-rust
v0.0.1
Published
Rust/WASM runtime for Gaesup-State stores, containers, compatibility checks, and render state
Downloads
21
Maintainers
Readme
gaesup-state-core-rust
Rust/WASM runtime package for Gaesup-State.
Most application code should install and import gaesup-state. This package exposes the generated WASM bindings used by the TypeScript API.
Install
npm install gaesup-state-core-rustEntry Points
| Entry | Target |
| --- | --- |
| gaesup-state-core-rust | Bundler target generated by wasm-pack --target bundler |
| gaesup-state-core-rust/web | Browser/web target generated by wasm-pack --target web |
| gaesup-state-core-rust/node | Node target generated by wasm-pack --target nodejs |
| gaesup-state-core-rust/bundler | Explicit alias for the bundler target |
Browser Usage
import init, { create_store, dispatch, select } from 'gaesup-state-core-rust/web';
await init();
create_store('counter', { count: 0 });
dispatch('counter', 'MERGE', { count: 1 });
console.log(select('counter', 'count'));Node Usage
import * as wasm from 'gaesup-state-core-rust/node';
wasm.create_store('counter', { count: 0 });
wasm.dispatch('counter', 'MERGE', { count: 1 });Build From Source
pnpm --filter gaesup-state-core-rust run buildThis requires:
- Rust toolchain
wasm32-unknown-unknowntargetwasm-pack
Install helper:
rustup target add wasm32-unknown-unknown
cargo install wasm-packPublished Files
The npm package includes:
pkgpkg-webpkg-node
Those directories are generated by wasm-pack. Run the build before publishing.
