scon-core 0.1.0

Strict, deterministic configuration parsing and Serde support for SCON
Documentation

scon-core

scon-core is the Rust implementation of SCON, a strict and deterministic configuration format inspired by HOCON. It provides parsing, sequential substitution resolution, explicit object and array spread, sandboxed file includes, formatting, source analysis, and Serde conversion.

The Cargo package is named scon-core; its Rust library name is scon.

Installation

[dependencies]
scon-core = "0.1"
serde = { version = "1", features = ["derive"] }

Example

use serde::Deserialize;

#[derive(Debug, Deserialize, PartialEq)]
struct App {
    name: String,
    port: u16,
}

# fn main() -> Result<(), scon::Error> {
let app: App = scon::from_str(
    r#"
    name = "demo"
    port = 8080
    "#,
)?;

assert_eq!(app, App { name: "demo".into(), port: 8080 });
# Ok(())
# }

Use scon::parse_file or scon::from_file when the document may contain include directives. scon::parse_str and scon::from_str intentionally do not provide filesystem access.

SCON v0.1 uses a single sequential resolution model: substitutions are resolved immediately and forward references are rejected. See the SCON v0.1 specification for the complete grammar and semantics.

Compatibility

  • Minimum supported Rust version: 1.85
  • License: MIT