[][src]Crate hocon

HOCON

Parse HOCON configuration files in Rust

HOCON Specifications

use hocon::HoconLoader;

let s = r#"{"a":5}"#;
let doc = HoconLoader::new().load_str(s)?.hocon()?;
let a = doc["a"].as_i64();

Support serde to deserialize to a struct

use serde::Deserialize;

use hocon::HoconLoader;

#[derive(Deserialize)]
struct Configuration {
    host: String,
    port: u8,
    auto_connect: bool,
}

let s = r#"{host: 127.0.0.1, port: 80, auto_connect: false}"#;

let conf: Configuration = HoconLoader::new().load_str(s)?.resolve()?;

Structs

HoconLoader

Helper to load an HOCON file

Enums

Hocon

HOCON document