2 releases
0.0.2 | Jun 5, 2024 |
---|---|
0.0.1 | Apr 14, 2024 |
#908 in Encoding
42KB
1K
SLoC
Serde libconfig
Under construction!
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.
Usage
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);
}
Dependencies
~0.5–1.1MB
~25K SLoC