openzeppelin_monitor::models

Trait ConfigLoader

Source
pub trait ConfigLoader: Sized {
    // Required methods
    fn load_all<'life0, 'async_trait, T>(
        path: Option<&'life0 Path>,
    ) -> Pin<Box<dyn Future<Output = Result<T, ConfigError>> + Send + 'async_trait>>
       where T: FromIterator<(String, Self)> + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn load_from_path<'life0, 'async_trait>(
        path: &'life0 Path,
    ) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validate(&self) -> Result<(), ConfigError>;
    fn validate_protocol(&self);
    fn resolve_secrets<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn is_json_file(path: &Path) -> bool { ... }
}
Expand description

Common interface for loading configuration files

Required Methods§

Source

fn load_all<'life0, 'async_trait, T>( path: Option<&'life0 Path>, ) -> Pin<Box<dyn Future<Output = Result<T, ConfigError>> + Send + 'async_trait>>
where T: FromIterator<(String, Self)> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Load all configuration files from a directory

If no path is provided, uses the default config directory.

Source

fn load_from_path<'life0, 'async_trait>( path: &'life0 Path, ) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load configuration from a specific file path

Source

fn validate(&self) -> Result<(), ConfigError>

Validate the configuration

Returns Ok(()) if valid, or an error message if invalid.

Source

fn validate_protocol(&self)

Validate safety of the protocol

Returns if safe, or logs a warning message if unsafe.

Source

fn resolve_secrets<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self, ConfigError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resolve all secrets in the configuration

Provided Methods§

Source

fn is_json_file(path: &Path) -> bool

Check if a file is a JSON file based on extension

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§