Skip to main content

camel_component_api/
bundle.rs

1use crate::ComponentRegistrar;
2
3/// A bundle groups one or more related component schemes and their shared config.
4///
5/// Bundles own their TOML key and deserialize their own config block.
6/// `camel-cli` uses `register_bundle!` to wire them.
7pub trait ComponentBundle: Sized {
8    /// Key under [components.<key>] in Camel.toml.
9    fn config_key() -> &'static str;
10
11    /// Deserialize the raw toml::Value block for this bundle.
12    fn from_toml(value: toml::Value) -> Result<Self, camel_api::CamelError>;
13
14    /// Register all schemes this bundle owns into the context.
15    fn register_all(self, ctx: &mut dyn ComponentRegistrar);
16}