Skip to content

Commit

Permalink
Merge pull request #330 from dherman/updated-templates
Browse files Browse the repository at this point in the history
Update `lib.rs` template for 0.2.
  • Loading branch information
dherman authored Jul 11, 2018
2 parents dcfdd28 + 2772556 commit 2fb8f54
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cli/templates/lib.rs.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#[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)
});

0 comments on commit 2fb8f54

Please sign in to comment.