serde_libconfig

Crates.ioserde_libconfig
lib.rsserde_libconfig
version0.0.2
sourcesrc
created_at2024-04-14 11:49:30.013268
updated_at2024-06-05 13:01:05.243416
descriptionA libconfig serialization file format
homepage
repositoryhttps://github.com/bastian-src/serde_libconfig
max_upload_size
id1208234
size52,728
Bastian Schmidt (bastian-src)

documentation

README

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);
}
Commit count: 12

cargo fmt