Trait plugx_config::loader::ConfigurationLoader
source · pub trait ConfigurationLoader: Send + Sync + Debug {
// Required methods
fn name(&self) -> &'static str;
fn scheme_list(&self) -> Vec<String>;
fn try_load(
&self,
source: &Url,
maybe_whitelist: Option<&[String]>
) -> Result<HashMap<String, ConfigurationEntity>, ConfigurationLoadError>;
}Expand description
A trait to load configurations for one or more plugins.
Required Methods§
sourcefn scheme_list(&self) -> Vec<String>
fn scheme_list(&self) -> Vec<String>
List of URL schemes that this loader supports.
Different URL may be assigned to this loader by their scheme value.
sourcefn try_load(
&self,
source: &Url,
maybe_whitelist: Option<&[String]>
) -> Result<HashMap<String, ConfigurationEntity>, ConfigurationLoadError>
fn try_load( &self, source: &Url, maybe_whitelist: Option<&[String]> ) -> Result<HashMap<String, ConfigurationEntity>, ConfigurationLoadError>
Main method that actually loads configurations.
- Checks the
sourceand detects its own options from it. - Checks whitelist to load just provided plugins configurations.
- Attempts to load configurations.
- Tries to set format for each ConfigurationEntity.