#serialization #serde #libconfig #file-format #serde-json

no-std serde_libconfig

A libconfig serialization file format

2 releases

0.0.2 Jun 5, 2024
0.0.1 Apr 14, 2024

#1013 in Encoding

Download history 31/week @ 2024-07-15 30/week @ 2024-07-22 12/week @ 2024-07-29 8/week @ 2024-08-26 7/week @ 2024-09-23 13/week @ 2024-09-30

135 downloads per month

Apache-2.0

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–1MB
~24K SLoC