{"id":31769202,"url":"https://github.com/second-state/wasmedge_plugin_rust_sdk","last_synced_at":"2025-10-10T02:41:56.009Z","repository":{"id":66972164,"uuid":"604144324","full_name":"second-state/wasmedge_plugin_rust_sdk","owner":"second-state","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-29T09:32:43.000Z","size":114,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-04T18:55:58.125Z","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/second-state.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-20T12:33:13.000Z","updated_at":"2025-09-01T06:48:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"907e4f22-24d2-4da7-933e-f6f755d67622","html_url":"https://github.com/second-state/wasmedge_plugin_rust_sdk","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":0.5,"last_synced_commit":"3144ca866256359a0bfe8b08f1ce98d5004bf86f"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/second-state/wasmedge_plugin_rust_sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Fwasmedge_plugin_rust_sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Fwasmedge_plugin_rust_sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Fwasmedge_plugin_rust_sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Fwasmedge_plugin_rust_sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/second-state","download_url":"https://codeload.github.com/second-state/wasmedge_plugin_rust_sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/second-state%2Fwasmedge_plugin_rust_sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002541,"owners_count":26083403,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-10T02:41:53.782Z","updated_at":"2025-10-10T02:41:56.004Z","avatar_url":"https://github.com/second-state.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Rust SDK for creating WasmEdge Plugins\n\nWasmEdge plugins are packaged host functions that allow Wasm programs running inside WasmEdge to access native functions and vice versa. The plugin system makes WasmEdge extensible.\n\n## Install WasmEdge\n\n```bash\ncurl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v 0.14.0\n```\n\n## Example 1: Hello world -- Wasm calls plugin\n\nThis demo shows how to call a host function registered in the plugin from a Wasm program running inside WasmEdge.\n\n### Plugin\n\nThe plugin source code is [here](examples/plugin/hello_plugin/). You can build it with\n\n```bash\ncd examples/plugin/hello_plugin\ncargo build --release\n```\n\nThe build result is a `libhello_plugin.so` file that you can copy into WasmEdge's plugin directory.\n\n```bash\ncp ../../../target/release/libhello_plugin.so /usr/local/lib/wasmedge/\n... or ...\ncp ../../../target/release/libhello_plugin.so ~/.wasmedge/plugin\n```\n\nThe plugin provides a native host function `hello()` that prints a line of text to the system console.\n\n### Wasm program\n\nThe Wasm program source code is [here](examples/wasm/hello_world/). It compiles into a Wasm program that calls the native host function `hello()` in the plugin. Build it with\n\n```bash\ncd examples/wasm/hello_world\ncargo build --release\n```\n\nRun it with the following command. It calls the `hello()` host function in the plugin to print the text.\n\n```bash\nwasmedge ../../../target/wasm32-wasi/release/hello_world.wasm\n```\n\n\n## Example 2: Stateful plugin -- Wasm calls plugin\n\nThis demo shows how to manage application state in the plugin, and have the state available to the Wasm programs through host functions.\n\n### Plugin\n\nThe plugin source code is [here](examples/plugin/stateful_plugin/). You can build it with\n\n```bash\ncd examples/plugin/stateful_plugin\ncargo build --release\n```\n\nThe build result is a `libstateful_plugin.so` file that you can copy into WasmEdge's plugin directory.\n\n```bash\ncp ../../../target/release/libstateful_plugin.so /usr/local/lib/wasmedge/\n... or ...\ncp ../../../target/release/libstateful_plugin.so ~/.wasmedge/plugin\n```\n\nThe plugin maintains an internal state in a `(x,y)` tuple, and exposes two host functions, `add_x()` and `add_y()` to manipulate the tuple value. The tuple is initialized to `(0,0)` in the plugin source code.\n\n### Wasm program\n\nThe Wasm program source code is [here](examples/wasm/call_stateful_plugin/). It compiles into a Wasm program that calls the host functions in the plugin. Build it with\n\n```bash\ncd examples/wasm/call_stateful_plugin\ncargo build --release\n```\n\nRun it with the following command. It calls the `add_x()` and `add_y()` host functions in the plugin to manipulate the tuple data in the plugin.\n\n```bash\nwasmedge ../../../target/wasm32-wasi/release/call_stateful_plugin.wasm\n```\n\n## Example 3: Memory access -- Plugin calls Wasm\n\nThis demo shows how a host function in the plugin accesses memory in the Wasm program. It allows host functions to exchange dynamic data (e.g., strings and arrays) with the Wasm program.\n\n### Plugin\n\nThe plugin source code is [here](examples/plugin/memory_access_plugin/). You can build it with\n\n```bash\ncd examples/plugin/memory_access_plugin\ncargo build --release\n```\n\nThe build result is a `libmemory_access_plugin.so` file that you can copy into WasmEdge's plugin directory.\n\n```bash\ncp ../../../target/release/libmemory_access_plugin.so /usr/local/lib/wasmedge/\n... or ...\ncp ../../../target/release/libmemory_access_plugin.so ~/.wasmedge/plugin\n```\n\nThe plugin provides two native host functions \n\n* `get_data()` allows the host function to access and modify memory managed by the Wasm runtime.\n* `to_uppercase()` takes the memory space for a string in the Wasm runtime, and turns the in-memory string into upper case.\n\n### Wasm program\n\nThe Wasm program source code is [here](examples/wasm/call_memory_access/). It compiles into a Wasm program that calls the native host functions `get_data()` and `to_uppercase()` in the plugin. Build it with\n\n```bash\ncd examples/wasm/call_memory_access\ncargo build --release\n```\n\nRun it with the following command.\n\n```bash\nwasmedge ../../../target/wasm32-wasi/release/call_memory_access.wasm\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecond-state%2Fwasmedge_plugin_rust_sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecond-state%2Fwasmedge_plugin_rust_sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecond-state%2Fwasmedge_plugin_rust_sdk/lists"}