Fix cargo build
This commit is contained in:
parent
b508ff4428
commit
b6060c85cd
2 changed files with 15 additions and 1 deletions
8
build.rs
8
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")
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue