2021-11-05 19:31:36 +09:00
|
|
|
#[napi]
|
|
|
|
pub struct ClassWithFactory {
|
|
|
|
pub name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[napi]
|
|
|
|
impl ClassWithFactory {
|
|
|
|
#[napi(factory)]
|
|
|
|
pub fn with_name(name: String) -> Self {
|
|
|
|
Self { name }
|
|
|
|
}
|
2021-11-26 00:42:40 +09:00
|
|
|
|
|
|
|
#[napi]
|
|
|
|
pub fn set_name(&mut self, name: String) -> &Self {
|
|
|
|
self.name = name;
|
|
|
|
self
|
|
|
|
}
|
2021-11-05 19:31:36 +09:00
|
|
|
}
|