Crate config_lib

Crate config_lib 

Source
Expand description

§config-lib - Multi-Format Configuration Library

A high-performance configuration management library supporting multiple formats including CONF, NOML, TOML, and JSON with advanced features like format preservation, async operations, and schema validation.

§Quick Start

use config_lib::Config;

// Parse any supported format automatically
let mut config = Config::from_string("port = 8080\nname = \"MyApp\"", None)?;

// Access values with type safety
let port = config.get("port").unwrap().as_integer()?;
let name = config.get("name").unwrap().as_string()?;

// Modify and save (preserves format and comments)
config.set("port", 9000)?;

§Supported Formats

  • CONF - Built-in parser for standard .conf files (default)
  • NOML - Advanced configuration with dynamic features (feature: noml)
  • TOML - Standard TOML format with format preservation (feature: toml)
  • JSON - JSON format with edit capabilities (feature: json)

§Features

  • 🚀 High Performance - Zero-copy parsing where possible
  • 💾 Format Preservation - Maintains comments, whitespace, and formatting
  • ⚡ Async Native - Full async/await support (feature: async)
  • 🔍 Schema Validation - Type safety and validation (feature: schema)
  • 🌐 Cross Platform - Linux, macOS, and Windows support
  • 🔧 Type Safety - Rich type system with automatic conversions

Re-exports§

pub use config::Config;
pub use config::ConfigBuilder;
pub use config::ConfigValue;
pub use enterprise::ConfigManager;
pub use enterprise::EnterpriseConfig;
pub use error::Error;
pub use error::Result;
pub use value::Value;

Modules§

audit
Comprehensive audit logging system for configuration operations Comprehensive Audit Logging System
config
High-Level Configuration Management
enterprise
Enterprise-grade configuration management with advanced caching, performance optimizations, and multi-instance support. Provides thread-safe caching with Arc<RwLock> for high-concurrency environments and sub-50ns access times for cached values.
error
Error Handling
hot_reload
Hot reloading system for zero-downtime configuration updates Configuration Hot Reloading System
parsers
Configuration Format Parsers
value
Value types and operations for the config library.

Functions§

parse
Parse configuration from a string with optional format hint
parse_file
Parse configuration from a file, auto-detecting format from extension