{"id":18616684,"url":"https://github.com/sile/nowasm","last_synced_at":"2025-09-24T00:32:02.334Z","repository":{"id":248366392,"uuid":"813619358","full_name":"sile/nowasm","owner":"sile","description":"No-std, no-unsafe and no-dependencies WebAssembly 1.0 runtime for Rust","archived":false,"fork":false,"pushed_at":"2024-07-16T10:08:04.000Z","size":1166,"stargazers_count":45,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T05:25:58.909Z","etag":null,"topics":["nostd","rust","webassembly","webassembly-runtime"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/sile.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-11T12:24:27.000Z","updated_at":"2024-12-27T15:58:07.000Z","dependencies_parsed_at":"2024-07-14T11:49:56.036Z","dependency_job_id":"58dee3f8-7969-4475-b38f-c40968d28262","html_url":"https://github.com/sile/nowasm","commit_stats":{"total_commits":304,"total_committers":1,"mean_commits":304.0,"dds":0.0,"last_synced_commit":"5e910b012bfab01325611e4fb12a97c3b9260143"},"previous_names":["sile/nowasm"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fnowasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fnowasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fnowasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fnowasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sile","download_url":"https://codeload.github.com/sile/nowasm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234017063,"owners_count":18766444,"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":["nostd","rust","webassembly","webassembly-runtime"],"created_at":"2024-11-07T03:37:37.087Z","updated_at":"2025-09-24T00:31:57.028Z","avatar_url":"https://github.com/sile.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"nowasm\n======\n\n[![nowasm](https://img.shields.io/crates/v/nowasm.svg)](https://crates.io/crates/nowasm)\n[![Documentation](https://docs.rs/nowasm/badge.svg)](https://docs.rs/nowasm)\n[![Actions Status](https://github.com/sile/nowasm/workflows/CI/badge.svg)](https://github.com/sile/nowasm/actions)\n![License](https://img.shields.io/crates/l/nowasm)\n\n\n`nowasm` is a [WebAssembly 1.0][wasm-core-1] runtime that is implemented with no-std, no-unsafe and no-dependencies.\n\nThe goal is to provide a lightweight WebAssembly runtime that can be embedded wherever Rust is used, with a particular focus on Wasm-in-Wasm scenarios.\n\n[wasm-core-1]: https://www.w3.org/TR/wasm-core-1/\n\nTODO list until v0.1.0\n----------------------\n\n- [ ] Add validation phase (TBD)\n- [ ] Add doc comments\n- [ ] Add more tests\n\nSupported Extensions\n--------------------\n\n`nowasm` supports the following extensions necessary to run WebAssembly binaries built with the latest stable Rust compiler.\n- [sign-extension]\n\n[sign-extension]: https://github.com/WebAssembly/sign-extension-ops/blob/master/proposals/sign-extension-ops/Overview.md\n\nExamples\n--------\n\nPlease execute the command `$ cargo build --target wasm32-unknown-unknown --example hello` to build the following \"Hello World!\" printing code ([examples/wasm/hello.rs](examples/wasm/hello.rs)) into a WebAssembly binary:\n\n```rust\nextern \"C\" {\n    fn print(s: *const u8, len: i32);\n}\n\n#[no_mangle]\npub fn hello() {\n    let msg = \"Hello, World!\\n\";\n    unsafe {\n        print(msg.as_ptr(), msg.len() as i32);\n    }\n}\n```\n\n\nThen, you can execute the `hello()` function via the following command:\n```console\n$ cargo run --example call_hello\nHello, World!\n```\n\nThe code of [examples/call_hello.rs](examples/call_hello.rs) is as follows:\n```rust\nuse nowasm::{Env, HostFunc, Module, Resolve, StdVectorFactory, Val};\n\npub fn main() {\n    let wasm_bytes = include_bytes!(\"../target/wasm32-unknown-unknown/debug/examples/hello.wasm\");\n\n    let module = Module::\u003cStdVectorFactory\u003e::decode(wasm_bytes).expect(\"Failed to decode module\");\n\n    let mut instance = module\n        .instantiate(Resolver)\n        .expect(\"Failed to instantiate module\");\n\n    instance\n        .invoke(\"hello\", \u0026[])\n        .expect(\"Failed to invoke function\");\n}\n\nstruct Resolver;\n\nimpl Resolve for Resolver {\n    type HostFunc = Print;\n\n    fn resolve_func(\u0026self, module: \u0026str, name: \u0026str) -\u003e Option\u003cSelf::HostFunc\u003e {\n        assert_eq!(module, \"env\");\n        assert_eq!(name, \"print\");\n        Some(Print)\n    }\n}\n\nstruct Print;\n\nimpl HostFunc for Print {\n    fn invoke(\u0026mut self, args: \u0026[Val], env: \u0026mut Env) -\u003e Option\u003cVal\u003e {\n        let ptr = args[0].as_i32().expect(\"Not a i32\") as usize;\n        let len = args[1].as_i32().expect(\"Not a i32\") as usize;\n        let msg = std::str::from_utf8(\u0026env.mem[ptr..ptr + len]).expect(\"Invalid utf8\");\n        print!(\"{msg}\");\n        None\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fnowasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsile%2Fnowasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fnowasm/lists"}