Update `lib.rs` template for 0.2.
#[macro_use]
extern crate neon;
-use neon::vm::{Call, JsResult};
-use neon::js::JsString;
+use neon::prelude::*;
-fn hello(call: Call) -> JsResult<JsString> {
- let scope = call.scope;
- Ok(JsString::new(scope, "hello node").unwrap())
+fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
+ Ok(cx.string("hello node"))
}
-register_module!(m, {
- m.export("hello", hello)
+register_module!(mut cx, {
+ cx.export_function("hello", hello)
});
