Skip to content

Specify exported methods as setters and getters in the property attribute #547

@ghost

Description

Add an option to specify exported methods as setters and getters in the property attribute when deriving property registration:

#[derive(NativeClass)]
#[inherit(Reference)]
struct Foo {
    #[property(set = "set_bar", get = "get_bar")]
    bar: i64,
}

#[methods] 
impl Foo {
    #[export]
    fn set_bar(&mut self, _owner: &Reference, value: i64) {
        self.bar = value;
    }

    #[export]
    fn get_bar(&mut self, _owner: &Reference) -> i64 {
        self.bar
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: exportComponent: export (mod export, derive)featureAdds functionality to the library

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions