Fix cargo build

This commit is contained in:
LongYinan 2019-02-22 11:04:13 +08:00
parent b508ff4428
commit b6060c85cd
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
2 changed files with 15 additions and 1 deletions

View file

@ -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")

View file

@ -18,6 +18,10 @@ pub enum Status {
HandleScopeMismatch,
CallbackScopeMismatch,
StringContainsNull,
QueueFull,
Closing,
BigintExpected,
Unknown,
}
impl From<napi_status> for Status {
@ -41,6 +45,10 @@ impl From<napi_status> 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,
}
}
}