Attribute Macro neon::main

Expand description

Marks a function as the main entry point for initialization in a Neon module.

This attribute should only be used once in a module and will be called each time the module is initialized in a context.

If a main function is not provided, all registered exports will be exported.

fn main(mut cx: ModuleContext) -> NeonResult<()> {
    // Export all registered exports
    neon::registered().export(&mut cx)?;

    let version = cx.string("1.0.0");

    cx.export_value("version", version)?;