serde_styx 1.0.0

Serde support for the Styx configuration language
Documentation

Serde support for the Styx configuration language.

This crate provides Styx serialization and deserialization using serde.

Deserialization Example

use serde::Deserialize;
use serde_styx::from_str;

#[derive(Deserialize, 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 serde::Serialize;
use serde_styx::to_string;

#[derive(Serialize, 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"));