-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update napi and fix more get_named_property calls
- Loading branch information
1 parent
bdf4a77
commit a493a8b
Showing
5 changed files
with
31 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use napi::{Error, JsObject, JsUnknown, Result}; | ||
|
||
// Workaround for https://github.com/napi-rs/napi-rs/issues/1641 | ||
pub fn get_named_property<T: TryFrom<JsUnknown, Error = Error>>(obj: &JsObject, property: &str) -> Result<T> { | ||
let unknown = obj.get_named_property::<JsUnknown>(property)?; | ||
T::try_from(unknown) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters