Derive Macro fav_derive::Attr

source ·
#[derive(Attr)]
{
    // Attributes available to this derive:
    #[attr]
}
Expand description

A derive macro helping implemente Attr trait.

§Example

use fav_core::attr::Attr;

#[derive(Attr)]
struct Res {
   id: i32,
   title: String,
}

#[derive(Attr)]
#[attr(id(res_id), title(res_name))]
struct Res_ {
   res_id: i32,
   res_name: String,
}

Default fields are id and title. In practice, the Res is comming from protobuf-codegen, making the attribute attr referring to the fields needed.