From 5527451b8d72d9c8e53dbba59b80f03cf3508cfc Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Sun, 14 Mar 2021 11:17:19 +0300 Subject: [PATCH] Remove deprecated `register_module` from example in README.md --- napi-derive/README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/napi-derive/README.md b/napi-derive/README.md index 63ae9338..43b0f4b2 100644 --- a/napi-derive/README.md +++ b/napi-derive/README.md @@ -4,19 +4,15 @@ ```rust #[macro_use] -extern crate napi; -#[macro_use] extern crate napi_derive; use napi::{CallContext, Error, JsNumber, JsUnknown, Module, Result, Status}; use std::convert::TryInto; -register_module!(napi_derive_example, init); - -fn init(module: &mut Module) -> Result<()> { - module.create_named_method("testThrow", test_throw)?; - - module.create_named_method("fibonacci", fibonacci)?; +#[module_exports] +fn init(mut exports: JsObject) -> Result<()> { + exports.create_named_method("testThrow", test_throw)?; + exports.create_named_method("fibonacci", fibonacci)?; Ok(()) }