Browse Source

Testing if Serde create groups

master
Julio Biason 5 years ago
parent
commit
58b312a678
  1. 10
      toml-groups/Cargo.toml
  2. 21
      toml-groups/src/main.rs

10
toml-groups/Cargo.toml

@ -0,0 +1,10 @@
[package]
name = "toml-groups"
version = "0.1.0"
authors = ["Julio Biason <julio.biason@pm.me>"]
edition = "2018"
[dependencies]
serde = "*"
serde_derive = "*"
toml = "0.5"

21
toml-groups/src/main.rs

@ -0,0 +1,21 @@
use serde_derive::Serialize;
use serde_derive::Deserialize;
#[derive(Serialize, Deserialize)]
struct Child {
name: String,
}
#[derive(Serialize, Deserialize)]
struct Main {
context: String,
child: Child,
}
fn main() {
let example = Main { context: "Main".to_string(),
child: Child { name: "child".to_string() } };
let content = toml::to_string(&example).unwrap();
println!("{:?}", content);
}
Loading…
Cancel
Save