{"id":17172660,"url":"https://github.com/jsonnull/rust-wasm","last_synced_at":"2025-04-13T16:12:01.278Z","repository":{"id":57665841,"uuid":"115847654","full_name":"jsonnull/rust-wasm","owner":"jsonnull","description":"A Rust and JavaScript utility suite for writing WebAssembly modules","archived":false,"fork":false,"pushed_at":"2018-01-26T03:01:09.000Z","size":331,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T18:23:01.102Z","etag":null,"topics":["javascript","rust","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsonnull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-31T06:43:26.000Z","updated_at":"2020-10-20T21:43:30.000Z","dependencies_parsed_at":"2022-08-31T01:22:36.726Z","dependency_job_id":null,"html_url":"https://github.com/jsonnull/rust-wasm","commit_stats":null,"previous_names":["jsonnull/wasm-rust-utils"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonnull%2Frust-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonnull%2Frust-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonnull%2Frust-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonnull%2Frust-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsonnull","download_url":"https://codeload.github.com/jsonnull/rust-wasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248726661,"owners_count":21151925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","rust","wasm","webassembly"],"created_at":"2024-10-14T23:37:37.324Z","updated_at":"2025-04-13T16:12:01.258Z","avatar_url":"https://github.com/jsonnull.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-wasm\n\n[![Build Status](https://travis-ci.org/jsonnull/rust-wasm.svg?branch=master)](https://travis-ci.org/jsonnull/rust-wasm)\n\nA Rust and JavaScript utility suite for writing WebAssembly modules.\n\n* Write functions with near-automatic string handling and memory management\n* Ergonomic memory management API if you want to avoid unnecessary allocations\n* No additional build-time tools required—use Cargo and your JavaScript bundler\n\n**Note:** This is in early stages, expect frequent API changes for now.\n\n---\n\n**lib.rs**\n\n```rust\nextern crate rust_wasm_prelude;\nuse rust_wasm_prelude::*;\n\npub use rust_wasm_prelude::exports::*;\n\n#[no_mangle]\npub fn to_uppercase(ptr: JsString) -\u003e JsString {\n    let mut s: String = js_string_input(ptr);\n    s = s.to_uppercase();\n    js_string_output(s)\n}\n```\n\n**index.js**\n\n```js\nimport { Prelude, types } from '@rust-wasm/prelude'\nimport loadWasm from './lib.rs'\n\nconst prelude = new Prelude()\n\nloadWasm()\n  .then(module =\u003e module.instance.exports)\n  .then(exports =\u003e {\n    prelude.withExports(exports)\n\n    const toUppercase = prelude.wrap(\n      types.string,\n      types.string,\n      exports.to_uppercase\n    )\n\n    console.log('uppercase of `test` is', toUppercase('test'))\n  })\n```\n\n## Installation\n\nAdd Rust dependency to your `Cargo.toml`\n\n```toml\nrust-wasm-prelude = \"0.3.0\"\nrust-wasm-utils = \"0.3.0\"\n```\n\nInstall JavaScript dependency with yarn/npm\n```bash\nyarn add @rust-wasm/prelude @rust-wasm/utils\n```\n\n## Examples\n\n* [Basic](/examples/basic): A buildable demo project showing the API essentials\n* [Memory Management](/examples/memory): The same as `basic`, but shows how to manage memory manually on the JS side\n\n## Acknowledgements\n\n* [HelloRust](https://github.com/badboy/hellorust) for showing how string\npassing functions are used by JavaScript and Rust \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonnull%2Frust-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsonnull%2Frust-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonnull%2Frust-wasm/lists"}