facet-styx 1.0.0

Facet integration for the Styx configuration language
Documentation

Styx format support for facet.

This crate provides Styx deserialization and serialization using the facet reflection system.

Deserialization Example

use facet::Facet;
use facet_styx::from_str;

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

let styx = "name myapp\nport 8080";
let config: Config = from_str(styx).unwrap();
assert_eq!(config.name, "myapp");
assert_eq!(config.port, 8080);

Serialization Example

use facet::Facet;
use facet_styx::to_string;

#[derive(Facet, Debug)]
struct Config {
    name: String,
    port: u16,
}

let config = Config { name: "myapp".into(), port: 8080 };
let styx = to_string(&config).unwrap();
assert!(styx.contains("name myapp"));
assert!(styx.contains("port 8080"));