hierconf-core 0.5.0

Core functionality for hierconf configuration management
Documentation
use facet::{Facet, Shape};
use facet_error as error;
use facet_toml::{DeserializeError, TomlError};

/// Errors that can occur in hierconf.
#[repr(u8)]
#[derive(Facet, Debug)]
#[facet(derive(Error))]
pub enum HierConfError {
    /// IO error: {0}
    #[facet(error::from)]
    Io(#[facet(opaque)] std::io::Error),
    /// Error during TOML deserialization: {0}
    #[facet(error::from)]
    Toml(#[facet(opaque)] DeserializeError<TomlError>),
    /// Missing required attribute: {0}
    MissingAttribute(String),
    /// Shape mismatch for attribute hierconf::{key}: found shape {shape:?}
    AttributeShapeMismatch {
        /// The shape that was found
        #[facet(opaque)]
        shape: &'static Shape,
        /// The attribute key
        key: &'static str,
    },
    /// No configuration files found at any of the checked locations: {locations:?}
    NoConfigFiles {
        /// The list of locations that were checked
        locations: Vec<camino::Utf8PathBuf>,
    },
}