* Implement FromNapiValue trait as macro
Code behavior should remain the same, with much less copy-pasting of the same code.
Additionally, this commit adds a unit tests for test for FromNapiValue
for tuple trait which appears to be currently missing.
* Simplify macro arr_get
Rewrite the macro to reduce the size of expanded code of the macro
(from 4088 to 2429 lines). Although this is a minor change,
this may help reduce the size of compiled library.
* Refactor typegen Type::Path
Removes the need for keeping mutable variable, as its only assigned once.
* [API BREAKING] Update api for calling functions.
This commit introduces new type FnArgs,
that is created with the goal of distinguishing between
calling JS function from rust with tuple as argument
and calling with multiple arguments.
Currently there is no possibility to add ToNapiValue value,
as tuple is used to call callback functions with more than one
argument from rust.
With this change, callbacks with multiple arguments,
should be called, with converting tuple of argument
into FnArgs struct, either by calling into() on such
tuple, or by creating FnArgs struct directly.
* Add support for FnArgs when generating TS types
Updated the macro for generating typescript types,
to correctly handle FnArgs struct. This is now treated
as passthrough type and generates the output from the
type inside of FnArgs struct.
* Implement ToNapiValue trait for tuple
With the changes to callback calling API, it's now possible
to safely add this change. This change allows to pass tuple
from rust code to JS to match the existing FromNapiValue trait
currently existing in the library.
* Fix from functions for BigInt
Allow proper parsing of negative integers in those functions.
Fixes the pannic when calling:
BigInt::from(i128::MIN);
* Fix get_i128 and get_i64 for BigInt
Update the getter logic to take sign into account.
for get_i128 and get_u128 make lossless value consistent with the documentation
(documentation described different behavior then the code logic)
* Extend tests for BigInt types
Add more test cases for negative i64 and i128 to test the created changes
* Simplify the to napiValue logic for 128 bit types
Update the logic to handle negative values properly
Refactor to_napi_value and create_bigint_from_*128 to use the same logic
instead of copping mostly the same code 4 times
* Fix specification for deserialize object test
For unknown reason the binary specification was holding different value than spec file