{"id":17925358,"url":"https://github.com/blyxyas/cargo-genplugin","last_synced_at":"2026-07-06T00:32:18.731Z","repository":{"id":132639916,"uuid":"603744061","full_name":"blyxyas/cargo-genplugin","owner":"blyxyas","description":"Rust plugin codegenerator","archived":false,"fork":false,"pushed_at":"2023-02-20T11:54:59.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-02T00:39:16.894Z","etag":null,"topics":["plugin-loader","plugin-system","plugins","rust","rust-crate"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blyxyas.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":"2023-02-19T13:01:55.000Z","updated_at":"2023-02-20T11:57:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"c995a785-1560-4222-af2e-8111654913cd","html_url":"https://github.com/blyxyas/cargo-genplugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blyxyas/cargo-genplugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Fcargo-genplugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Fcargo-genplugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Fcargo-genplugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Fcargo-genplugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blyxyas","download_url":"https://codeload.github.com/blyxyas/cargo-genplugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Fcargo-genplugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35174071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"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":["plugin-loader","plugin-system","plugins","rust","rust-crate"],"created_at":"2024-10-28T20:53:32.883Z","updated_at":"2026-07-06T00:32:18.712Z","avatar_url":"https://github.com/blyxyas.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cargo-genplugin\n\n`cargo-genplugin` is a plugin management system and interface designed to easily let the users add functionality.\n\nIt works by generating interface code, that the main code can import and use without worrying about loading libraries or creating wrappers.\n\n###### **Note: All functions must have the `#[no_mangle]` attribute**\n\n## Simple Example\n\n```rust\n// my_plugin/src/lib.rs\n#[no_mangle] // \u003c- Important!\nextern fn add(a: u32, b: u32) -\u003e u32 {\n\t// Custom functionality goes here\n\t// [...]\n\ta + b\n}\n```\n\n```toml\n# my_plugin/Cargo.toml\n# [...]\n[lib]\ncrate-type = [\"rlib\", \"cdylib\"]\n# [...]\n```\n\nThen run `cargo build -r`. This will create a file called `lib\u003cPLUGIN NAME\u003e.so` in your `target/release` directory.\n\nNow it's the moment to use the program. (You'll have to [install it](#installation) first)\n\n```\ncargo plugin my_plugin libmy_plugin.so\n```\n\nThis will generate a `stubs` cargo project, this project will contain generated code to load and use the plugin functions. In this example:\n\n```rust\n// stubs/src/lib.rs\n// File autogenerated by cargo-genplugin, you can use the `--fmt` flag to generate formatted files. Do not manually edit, it will be overwritten. Report issues @ github.com/blyxyas/cargo-genplugin. The following functions were generated:\n\n\t\t\t/*\n\t\t\t* add\n*/\nuse libloading;\n\t\t\tuse\tlazy_static;\n\t\t\t\tlazy_static::lazy_static! {\n\t\t\t\t\tstatic ref LIB: libloading::Library =\n\t\t\t\t\t\tunsafe { libloading::Library::new(\"/home/alejandra/git/wawawa/my_plugin/target/release/libmy_plugin.so\").expect(\"Couldn't load library libmy_plugin.so\") };\n\t\t\t\t}\n\t\t\t\npub unsafe extern fn add(a : u32 , b : u32)-\u003e u32 {let func:libloading::Symbol\u003cunsafe extern fn(a : u32 , b : u32) -\u003e u32\u003e=LIB.get(b\"add\").expect(\"Couldn't load function 'add'\");return func(a,b,);}\n```\n\n###### **Tip: You can use the flag `--fmt` to auto-format it.**\n\nnow you can import and use the function add anywhere in your code!\n\n```rust\n// my_code/src/main.rs\n\n#[cfg(feature = \"custom_add\")] // Feature gating might be useful\nunsafe fn add(a: u32, b: u32) -\u003e u32 {\n\tuse stubs::add;\n\tunsafe { add(a, b) }\n}\n\n#[cfg(not(feature = \"custom_add\"))]\nfn add(a: u32, b: u32) -\u003e u32 {\n\t// My boring normal `add` function\n\ta + b\n}\n\nfn main() {\n\tunsafe {\n\t\tlet x = add(1, 2); \n\t\tprintln!(\"{x}\");\n\t};\n}\n```\n\nTake into account that the code will always unsafe. Also take into account that plugged-in code can potentially be malicious.\n\n## Installation\n\nCurrently `cargo-genplugin` isn't uploaded to [crates.io](https://crates.io), so you'll have to manually compile it yourself.\n\n### Compiling the binary\n\n1. Get the repository\n\n```\ngit clone https://github.com/blyxyas/cargo-genplugin.git\ncd cargo-genplugin\n```\n\n2. Install the binary\n   \n```\ncargo install --path .\n```\n\n3. **✨ It's ready to use! ✨**\n\n```\ncargo genplugin --help\n```\n\n#### Stargazers\n\n[![Stargazers repo roster for @blyxyas/cargo-genplugin](https://reporoster.com/stars/blyxyas/cargo-genplugin)](https://github.com/blyxyas/cargo-genplugin/stargazers)\n\n#### LICENSE\n\n`cargo-genplugin` uses **Apache License 2.0**. [More information about licensing](https://github.com/blyxyas/cargo-genplugin/blob/main/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblyxyas%2Fcargo-genplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblyxyas%2Fcargo-genplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblyxyas%2Fcargo-genplugin/lists"}