| Crates.io | cargo-plugin |
| lib.rs | cargo-plugin |
| version | 0.1.0 |
| created_at | 2017-09-27 16:25:41.286603+00 |
| updated_at | 2017-09-27 16:25:41.286603+00 |
| description | compile time plugins for your Rust projects |
| homepage | |
| repository | https://github.com/Geal/cargo-plugin |
| max_upload_size | |
| id | 33675 |
| size | 10,550 |
Warning: experimental project, things might change soon
This tool helps you build a plugin infrastructure for your Rust project. Highlights of that system:
The rust-plugin-test project is an example of this usage.
Launch the following command:
cargo install cargo-plugin
This will work better if your project uses a workspace:
plugin-api crate defines traits that plugins should implement
cargo-plugin expects that this crates exposes a PluginInformation traitplugins crate holds the plugins
Cargo.toml file declares a dependency on plugin-api by version. This file will be rewritten by cargo-pluginmetadata.toml file indicates the plugin API crate's nameplugins/src:
metadata.toml file declaring its name and its dependenciesmod.rs file:
PLUGIN_METADATA const element that implements the PluginInformation traitmain crate:
You can now publish your crates, first the plugin API, then the plugins crate, then the main one.
Your crates are published with a default set of plugins. If you want to build a version with a different set of plugins, add and remove plugin folders in plugins/src, then run cargo plugin while in plugins/.
The cargo-plugin tool will read the metadata from every plugin folder, then edit the Cargo.toml and src/lib.rs to do the following tasks: