Introduction
spring
is the core module of this project, which includes: configuration management, plugin management, and component management.
- All plugins need to implement the
Plugin
trait. - All configurations need to implement the
Configurable
trait. - All components need to implement the
Clone
trait.
Note: To avoid deep copying of large struct in Component, it is recommended to use the newtype pattern to reference them via
Arc<T>
.
How to write your own plugin
Add dependencies
= { = "0.1.0" } # This crate contains the definition of plugin traits
= { = true, = ["derive"] } # Used to parse plugin configuration items
use Deserialize;
use async_trait;
use Configurable;
use ;
;
/// Plugin configuration
For the complete code, refer to plugin-example
, or refer to other built-in plugin codes.