doc: fix example
This commit is contained in:
parent
26f80b1511
commit
86c166eece
2 changed files with 2 additions and 2 deletions
|
@ -23,7 +23,7 @@ fn test_throw<'a>(_ctx: CallContext) -> Result<Value<'a, Any>> {
|
||||||
Err(Error::new(Status::GenericFailure))
|
Err(Error::new(Status::GenericFailure))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[js_function]
|
#[js_function(1)]
|
||||||
fn fibonacci<'env>(ctx: CallContext<'env>) -> Result<Value<'env, Number>> {
|
fn fibonacci<'env>(ctx: CallContext<'env>) -> Result<Value<'env, Number>> {
|
||||||
let n = ctx.get::<Number>(0)?.try_into()?;
|
let n = ctx.get::<Number>(0)?.try_into()?;
|
||||||
ctx.env.create_int64(fibonacci_native(n))
|
ctx.env.create_int64(fibonacci_native(n))
|
||||||
|
|
|
@ -9,7 +9,7 @@ extern crate napi_rs_derive;
|
||||||
use napi_rs::{Result, Value, CallContext, Number};
|
use napi_rs::{Result, Value, CallContext, Number};
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
#[js_function]
|
#[js_function(1)]
|
||||||
fn fibonacci<'env>(ctx: CallContext<'env>) -> Result<Value<'env, Number>> {
|
fn fibonacci<'env>(ctx: CallContext<'env>) -> Result<Value<'env, Number>> {
|
||||||
let n = ctx.get::<Number>(0)?.try_into()?;
|
let n = ctx.get::<Number>(0)?.try_into()?;
|
||||||
ctx.env.create_int64(fibonacci_native(n))
|
ctx.env.create_int64(fibonacci_native(n))
|
||||||
|
|
Loading…
Reference in a new issue