Skip to main content

ConfigHandler

Trait ConfigHandler 

Source
pub trait ConfigHandler {
    // Required methods
    fn claimed_categories(&self) -> Vec<CategoryClaim>;
    fn handle_category(
        &mut self,
        category: &str,
        name: &str,
        properties: PropertyMap,
    ) -> Result<()>;

    // Provided methods
    fn claimed_properties(&self) -> HashMap<&str, &[&str]> { ... }
    fn handle_properties(
        &mut self,
        _category: &str,
        _name: &str,
        _properties: PropertyMap,
    ) -> Result<()> { ... }
}
Expand description

Handles configuration for one or more categories.

Required Methods§

Source

fn claimed_categories(&self) -> Vec<CategoryClaim>

Categories this handler owns, with optional selector filtering. A claim with no selector owns all definitions in that category. Multiple handlers may claim the same category only if all use selectors.

Source

fn handle_category( &mut self, category: &str, name: &str, properties: PropertyMap, ) -> Result<()>

Handle a definition in an owned category. Properties claimed by other handlers will be excluded.

Provided Methods§

Source

fn claimed_properties(&self) -> HashMap<&str, &[&str]>

Properties this handler uses, keyed by category. Category owners should include their own properties (under their own category) to prevent other handlers from claiming them. Properties claimed on other handlers’ categories will be split off and routed via handle_properties.

Source

fn handle_properties( &mut self, _category: &str, _name: &str, _properties: PropertyMap, ) -> Result<()>

Handle claimed properties from a category this handler does not own.

Implementors§