SANE Serialization and Deserialization for Rust
Spec: https://opensource.bloom.sh/sane
Compatible with SANE version: v1.0.0
``rust
//! An example showing off the usage of
Deserializeto automatically decode
//! SANE into a Rust
struct`
use sane; use serde::{Deserialize};
/// This is what we're going to decode into. Each field is optional, meaning /// that it doesn't have to be present in SANE.
struct Config {
globalstring: Option
/// Sub-structs are decoded from tables, so this will decode from the [server]
/// table.
///
/// Again, each field is optional, meaning they don't have to be present.
struct ServerConfig {
ip: Option
struct PeerConfig {
ip: Option
fn main() { let sanestr = r#" globalstring = "test" global_integer = 5 server = { ip = "127.0.0.1", port = 80 } peers = [ { ip = "127.0.0.1", port = 8080, }, { ip = "127.0.0.1" }, ] "#;
let decoded: Config = sane::from_str(sane_str).unwrap();
println!("{:#?}", decoded);
} ```
Thank you for your interest in contributing! Please refer to https://opensource.bloom.sh/contributing for guidance.
See LICENSE.txt
and https://opensource.bloom.sh/licensing
From an original work by alexcrichton: toml-rs - commit d729bf9c53fcfe8f1e5506a938b88d81526b55a4