Add README and examples

This commit is contained in:
2026-09-05 23:30:06 +00:00
parent d4b77ddcb9
commit 51b6c635d7
4 changed files with 206 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct ServiceConfig {
name: String,
enabled: bool,
retries: i64,
endpoints: Vec<String>,
}
fn main() -> wson::Result<()> {
let value = ServiceConfig {
name: "worker".to_string(),
enabled: true,
retries: 3,
endpoints: vec![
"https://a.example".to_string(),
"https://b.example".to_string(),
],
};
let text = wson::to_string(&value)?;
println!("text: {text}");
let decoded: ServiceConfig = wson::from_str(&text)?;
assert_eq!(decoded, value);
println!("round trip ok");
Ok(())
}