context-mapper

Crates.iocontext-mapper
lib.rscontext-mapper
version0.1.1
sourcesrc
created_at2024-02-04 23:25:20.227957
updated_at2024-02-05 21:12:56.872948
description Single rust macro for generating different maps
homepage
repository
max_upload_size
id1126761
size7,819
Tomasz Durda (Dzordzu)

documentation

README

Context Mapper

Single rust macro for generating different maps

Links

Example

#[derive(ContextMapper)]
#[context_mapper(
    impl(
        context = info::general
        converter = MyConv::to_info,
        type = info::Info,
        fn = general_info
        vis = pub(crate)
    ),
    function(
        context = info::all
        converter = MyConv::to_info,
        type = info::Info,
        fn = all_info
    ),

)]
struct Person {
    name: String,
    address: info::Address,
    age: usize,

    /// Let's hide it for the geneal info, but show for the rest
    #[context_attribute(context(name=info::general, skip))]
    is_a_reptile: bool
}

// …

let person = Person {
    //…
};

person.general_info();
all_info(&person);
Commit count: 0

cargo fmt