serialize_display_adapter_macro_derive

Crates.ioserialize_display_adapter_macro_derive
lib.rsserialize_display_adapter_macro_derive
version0.2.0
sourcesrc
created_at2024-05-20 14:11:27.278271
updated_at2024-07-14 03:10:30.927819
descriptionAutomatically impl Display for struct that implementated serde::Serialize
homepagehttps://github.com/Cryolitia/GPD-LinuxControls/tree/main/serialize_display_adapter_macro_derive
repository
max_upload_size
id1245762
size4,257
PukNgae Cryolitia (Cryolitia)

documentation

README

Serialize Display Adapter Macro Derive

use serde::Serialize;
use serialize_display_adapter_macro_derive::PrettyJsonSerializeDisplayAdapter;

#[derive(Serialize, PrettyJsonSerializeDisplayAdapter)]
struct Demo<'a> {
    name: &'a str,
    age: u8,
}
fn main() {
    let name = "root";
    let demo = Demo {
        name: name.as_ref(),
        age: 42,
    };
    print!("{}", demo)
}

// Should print:
//
// {
//     "name": "root",
//     "age": 42
// }
Commit count: 0

cargo fmt