From f751ea3b2a80901e37f0bcfaca6d0922cd1bc679 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sat, 2 May 2020 00:21:38 +0800 Subject: [PATCH] chore: remove lifetime param in example --- README.md | 2 +- napi-derive-example/src/lib.rs | 4 ++-- napi-derive/README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9488474d..aea9a5a4 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ One nice feature is that this crate allows you to build add-ons purely with the ## Taste ```rust #[js_function(1)] // ------> arguments length, omit for zero -fn fibonacci<'env>(ctx: CallContext<'env>) -> Result> { +fn fibonacci(ctx: CallContext) -> Result> { let n = ctx.get::(0)?.try_into()?; ctx.env.create_int64(fibonacci_native(n)) } diff --git a/napi-derive-example/src/lib.rs b/napi-derive-example/src/lib.rs index d5755677..3f997200 100644 --- a/napi-derive-example/src/lib.rs +++ b/napi-derive-example/src/lib.rs @@ -19,12 +19,12 @@ fn init<'env>( } #[js_function] -fn test_throw<'a>(_ctx: CallContext) -> Result> { +fn test_throw(_ctx: CallContext) -> Result> { Err(Error::new(Status::GenericFailure)) } #[js_function(1)] -fn fibonacci<'env>(ctx: CallContext<'env>) -> Result> { +fn fibonacci(ctx: CallContext) -> Result> { let n = ctx.get::(0)?.try_into()?; ctx.env.create_int64(fibonacci_native(n)) } diff --git a/napi-derive/README.md b/napi-derive/README.md index e8be009b..061d57fb 100644 --- a/napi-derive/README.md +++ b/napi-derive/README.md @@ -10,7 +10,7 @@ use napi_rs::{Result, Value, CallContext, Number}; use std::convert::TryInto; #[js_function(1)] -fn fibonacci<'env>(ctx: CallContext<'env>) -> Result> { +fn fibonacci(ctx: CallContext) -> Result> { let n = ctx.get::(0)?.try_into()?; ctx.env.create_int64(fibonacci_native(n)) }