Module loader

Module loader 

Source
Expand description

Configuration loader trait and implementations.

A configuration loader only loads contents of configurations for plugins. No parsing is done here. The result is just a Vec<(String, ConfigurationEntity)> with plugin names (in lowercase) as first element and ConfigurationEntity as values for each plugin. A loader also should try to set contents format for each plugin. For example fs loader (that loads configurations from filesystem) guesses content formats from file extensions.

Every configuration loader (every implementor of Loader) accepts a URL and maybe a whitelist of plugin names. It can parse the URL to detect and validate its own options. For example env (that loads configuration from environment-variables) accepts a URL like env://?prefix=MY_APP_NAME.

Also, a Loader can be mark some errors skippable! For more information refer to documentation of the loader itself.

Note that generally you do not need to implement Loader, provided closure lets you make your own loader with just one Fn closure.

Modules§

closure
Custom configuration loader with Fn.
env
Environment-Variables configuration loader (env feature which is enabled by default).
fs
File system configuration loader (fs feature).

Enums§

Error
Load error type.
SoftErrors
Soft errors deserializer wrapper for URL query strings.

Traits§

Loader
A trait to load configurations for one or more plugins.

Functions§

deserialize_query_string
Checks query-string part of URL and tries to deserialize it to provided type. (qs Cargo feature)