lib-humus-configuration 0.2.0

Helper crate for reading configuration files into data structures using serde.
Documentation
// SPDX-FileCopyrightText: 2025 Slatian
//
// SPDX-License-Identifier: LGPL-3.0-or-later

//! lib-humus-configuration helps with reading a configuration file into a data structure.
//!
//! It currently supports JSON, JSON5 and TOML.
//!
//! ```rust
//! # #[cfg(feature = "json")]
//! # {
//! use serde::Deserialize;
//! use lib_humus_configuration::read_from_json_file;
//!
//! #[derive(Deserialize)]
//! struct TestData {
//! 	text: String,
//! 	n: i64,
//! }
//!
//! let test_data: TestData = read_from_json_file("test-data/test.json").unwrap();
//!
//! assert_eq!(test_data.text, "Foo Bar".to_string());
//! assert_eq!(test_data.n, 123);
//! # }
//! ```
//!
//! This is a companion crate to [lib-humus](https://docs.rs/lib-humus).
//!
//! ## Feature Flags
//!
//! Each format is gated behind its own feature flag, at least one of the has to be enabled.
//!
//! * `json` using the `serde_json` crate.
//! * `json5` using the `json5` crate.
//! * `toml` using the `toml` crate.
//! * `full` enables all supported formats.
//!

#![warn(missing_docs)]
#![allow(clippy::tabs_in_doc_comments)]

mod error;
mod format;
mod io;
mod settings;

#[cfg(test)]
mod test;

pub use error::ErrorCause;
pub use error::HumusConfigError;
pub use format::ConfigFormat;
pub use io::read_from_file;
pub use settings::Settings;

#[cfg(feature = "json")]
pub use io::read_from_json_file;
#[cfg(feature = "json5")]
pub use io::read_from_json5_file;
#[cfg(feature = "toml")]
pub use io::read_from_toml_file;

#[cfg(not(any(feature = "json", feature = "json5", feature = "toml")))]
compile_error!(
	"Please enable at least one of the format features on the lib-humus-configuration crate: json, json5 or toml"
);