napi-rs/examples/napi/src/class_factory.rs

13 lines
179 B
Rust
Raw Normal View History

#[napi]
pub struct ClassWithFactory {
pub name: String,
}
#[napi]
impl ClassWithFactory {
#[napi(factory)]
pub fn with_name(name: String) -> Self {
Self { name }
}
}