hyperi-rustlib 1.14.0

Shared utility library for HyperI Rust applications
Documentation

hyperi-rustlib

Shared utility library for HyperI Rust applications.

Provides configuration management, structured logging, Prometheus metrics, and environment detection - matching the functionality of hyperi-pylib (Python) and hyperi-golib (Go).

Quick Start

use hyperi_rustlib::{env, config, logger, metrics};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Detect runtime environment
    let environment = env::Environment::detect();
    println!("Running in: {:?}", environment);

    // Initialise logger (respects LOG_LEVEL env var)
    logger::setup_default()?;

    // Load configuration with 7-layer cascade
    config::setup(config::ConfigOptions {
        env_prefix: "MYAPP".into(),
        ..Default::default()
    })?;

    // Access config
    let cfg = config::get();
    let db_host = cfg.get_string("database.host").unwrap_or_default();

    // Create metrics
    let metrics_mgr = metrics::MetricsManager::new("myapp");
    let _counter = metrics_mgr.counter("requests_total", "Total requests processed");

    tracing::info!(db_host = %db_host, "Application started");
    Ok(())
}