odradev / odra

Odra framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autogenerate `new` for events.

zie1ony opened this issue · comments

It's common to implement sth like this:

#[odra::event]
pub struct Mint {
    recipient: Address,
    token_id: String,
    data: String
}

impl Mint {
    pub fn new(recipient: Address, token_id: String, data: String) -> Self {
        Self {
            recipient,
            token_id,
            data
        }
    }
}

new could be derived by default with an option to remove it with odra::event(skip_new).