Crates.io | serde_libconfig |
lib.rs | serde_libconfig |
version | 0.0.2 |
source | src |
created_at | 2024-04-14 11:49:30.013268 |
updated_at | 2024-06-05 13:01:05.243416 |
description | A libconfig serialization file format |
homepage | |
repository | https://github.com/bastian-src/serde_libconfig |
max_upload_size | |
id | 1208234 |
size | 52,728 |
I'm new to Rust development and came to write a Serializer for libconfig. It's basically the official serde json example with some changes to make it serialize into libconfig format. I'm planning on adding the Deserializer too.
So, you're welcome to make PRs, leave comments, or just give me hints on how to do things better.
use serde::{Serialize};
#[derive(Serialize, Debug)]
struct MySubStruct {
sub_d: u16,
}
#[derive(Serialize, Debug)]
struct MyStruct {
a: u16,
b: String,
c: MySubStruct,
}
fn main() {
let my_struct = MyStruct {
a: 123,
b: "ajo".to_string(),
c: MySubStruct { sub_d: 456},
};
let serialized = serde_libconfig::to_string(&my_struct).unwrap();
println!("libconfig serialized:\n{}", serialized);
}