noema 0.4.0

Noema IOC and DI framework for Rust
Documentation
use std::fmt;

/// Error from source I/O, mapping, or the load lifecycle.
#[derive(Debug)]
pub enum ConfigError {
    AlreadyLoaded(&'static str),
    MissingKey(String),
    Parse { key: String, message: String },
    Source(String),
}

impl fmt::Display for ConfigError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::AlreadyLoaded(name) => write!(f, "config {name} is already loaded"),
            Self::MissingKey(key) => write!(f, "missing required config key {key}"),
            Self::Parse { key, message } => write!(f, "invalid config {key}: {message}"),
            Self::Source(message) => write!(f, "config source: {message}"),
        }
    }
}

impl std::error::Error for ConfigError {}