{"id":29275864,"url":"https://github.com/peterroe/wasm-rust-demo","last_synced_at":"2025-07-05T07:11:26.593Z","repository":{"id":42895643,"uuid":"473114639","full_name":"peterroe/wasm-rust-demo","owner":"peterroe","description":"Demo of converting rust code to javascript code through webAssembly","archived":false,"fork":false,"pushed_at":"2023-12-15T05:13:20.000Z","size":91,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-15T06:29:10.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterroe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-23T09:17:02.000Z","updated_at":"2023-12-15T06:29:10.923Z","dependencies_parsed_at":"2022-08-24T14:34:42.678Z","dependency_job_id":null,"html_url":"https://github.com/peterroe/wasm-rust-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/peterroe/wasm-rust-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Fwasm-rust-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Fwasm-rust-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Fwasm-rust-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Fwasm-rust-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterroe","download_url":"https://codeload.github.com/peterroe/wasm-rust-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterroe%2Fwasm-rust-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263699785,"owners_count":23497963,"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":[],"created_at":"2025-07-05T07:11:22.360Z","updated_at":"2025-07-05T07:11:26.582Z","avatar_url":"https://github.com/peterroe.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Run rust code in browser\n\nRun rust code in browser.\n\n## Try it out\n\n* Make sure you have installed the enviroment of rust.\n* And run the following command in your terminal.\n\n### Development local\n\n```\n$ git clone git@github.com:peterroe/wasm-rust-demo.git\n$ cd wasm-rust-demo\n```\n\n### Install complier tool\n\nFor complation, We need another complation target `wasm-unknown-unknown`.\n\n```shell\n$ rustup target add wasm32-unknown-unknown\n```\n\n### Build\n\nNow you can build the project.\n\n```shell\n$ cargo build --target wasm32-unknown-unknown\n```\n\nThe above command will generate `digets.wasm` file in `target/wasm32-unknown-unknown/debug/` directory.\n\n### Convert wasm to javascript\n\nYour need install a another tool to convert wasm to javascript.\n\n```shell\n$ cargo install wasm-bindgen-cli\n```\n\nAnd then convert the wasm file.\n\n```shell\n$ wasm-bindgen-cli target/wasm32-unknown-unknown/debug/digets.wasm --out-dir ./web --web\n```\n\nNow you will see the directory structure as below.\n\n```shell\n├─ src  \n│  └─ lib.rs\n├─ target\n│  └─ wasm32-unknown-unknown\n│     └─ debug\n│        └─ digets.wasm\n├─ web\n│  └─ digets.js\n└─ index.html\n```\n\n## Start Web Server\n\nI recommend you to use `vite` to start the web server.\n\n```shell\n$ npm install -g vite   # install vite\n$ vite -v               # check the version of vite\nvite/2.7.10 win32-x64 node-v14.18.2 \n$ vite --port 3000      # open the dev server\n```\n\nJust run and visit http://localhost:3000\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterroe%2Fwasm-rust-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterroe%2Fwasm-rust-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterroe%2Fwasm-rust-demo/lists"}