Skip to content

A serialization-like derive macro with attribute implementations

Notifications You must be signed in to change notification settings

fruit-bird/intomap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#[derive(IntoMap)]

An implementation of a serialization-like trait. Inspired by Chapter 9 of "The Complete Rust Programming Reference Guide"

Check out my blog post explaining this. It cover more concepts than the aforementioned book, like derive attributes

Usage

#[derive(IntoMap)]
struct User {
    name: &'static str,
    #[intomap(ignore)]
    id: usize,
    #[intomap(rename = "online")]
    active: bool,
}

let user = User {
    name: "Jimothy",
    id: 0,
    active: true,
};

let user_map = user.as_map();
println!("{:#?}", user_map);
BTreeMap {
    "name": "Jimothy",
    "online": "true",
}

What is This?

Started with trying to learn how derive macros work. Ended with me starting a blog

About

A serialization-like derive macro with attribute implementations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages