From b6060c85cd45e6d10001d54307ef0d66b3075a7f Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 22 Feb 2019 11:04:13 +0800 Subject: [PATCH] Fix cargo build --- build.rs | 8 +++++++- src/sys/stable.rs | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index c1e2a459..321eedf1 100644 --- a/build.rs +++ b/build.rs @@ -53,7 +53,13 @@ fn main() { // Activate the "node8" or "nodestable" feature for compatibility with // different versions of Node.js/N-API. - println!("cargo:rustc-cfg=node{}", node_major_version); + println!("cargo:rustc-cfg=node{}", if node_major_version > 8 { + "stable" + } else if node_major_version == 8 { + "8" + } else { + panic!("node version is too low") + }); bindgen::Builder::default() .header("src/sys/bindings.h") diff --git a/src/sys/stable.rs b/src/sys/stable.rs index ca64c52b..f94440aa 100644 --- a/src/sys/stable.rs +++ b/src/sys/stable.rs @@ -18,6 +18,10 @@ pub enum Status { HandleScopeMismatch, CallbackScopeMismatch, StringContainsNull, + QueueFull, + Closing, + BigintExpected, + Unknown, } impl From for Status { @@ -41,6 +45,10 @@ impl From for Status { napi_escape_called_twice => EscapeCalledTwice, napi_handle_scope_mismatch => HandleScopeMismatch, napi_callback_scope_mismatch => CallbackScopeMismatch, + napi_queue_full => QueueFull, + napi_closing => Closing, + napi_bigint_expected => BigintExpected, + _ => Unknown, } } }