You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
446 B
21 lines
446 B
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); |
|
}
|
|
|