Commit graph

26 commits

Author SHA1 Message Date
LongYinan
291def2d70
perf(napi): make FuturePromise static dispatch 2021-06-21 23:36:54 +08:00
LongYinan
72960906dc
ci: add memory leak detect job 2021-05-29 23:24:25 +08:00
LongYinan
457cc6f1ee
refactor: change more generic constraint from NapiValue => NapiRaw 2021-05-17 17:29:38 +08:00
LongYinan
5a21bbeb8e
fix(napi): memory ordering issues in tsfn 2021-04-12 18:04:02 +08:00
LongYinan
f0b8c5da07
fix(napi): do not call release tsfn in Drop when ref count is 0 2021-03-31 21:31:37 +08:00
Daniel Henry-Mantilla
0204ef9342 Added a way to opt out of error handling for ThreadsafeFunctions.
This is to allow having the `ThreadSafeFunction` expect the same calling API
as an unwrapped `JsFunction` would have: in some contexts this consistency is
more desireable than giving the option to the caller to handle a native-to-js
conversion failure (or somebody having directly fed a `Result<T>`; although
that use case seems oddly niche to me: it can already be covered when
`type T = Result<U>;` and propagated/flattened inside the `R` closure with a
simple `?`), since such failure can already be quite fatal / unexpected in
some cases.

In order to keep the code backwards-compatible, this PR uses an added
**optional** generic (type) parameter. Since this parameter, semantically,
represents an `enum`, and since we don't have yet `const_generic` `enum`s, we
circumvent this limitation by using the type-level enum pattern, which is
abtracted away with a helper macro that incidentally yields some handy docs
(I can attach a rendered version of the docs hosted on netlify if the reviewer
so wishes).
2021-03-09 23:51:12 +01:00
LongYinan
071dcff9eb
feat(napi): add back clone trait to ThreadsafeFunction 2021-02-26 18:38:48 +08:00
LongYinan
f46aa1f67a
fix(napi): throw JavaScript error in tsfn rather than rust thread panic 2021-01-25 12:11:12 +08:00
LongYinan
f90640d7aa
docs: update documents 2020-12-03 17:17:40 +08:00
LongYinan
ba9744e89c
refactor(napi): reduce useless type cast 2020-12-02 18:39:20 +08:00
LongYinan
5ffb14729d
refactor(napi): js error 2020-12-02 14:56:19 +08:00
LongYinan
1a3621b727
feat(napi): major upgrades for napi@1
1. inline everything
2. change `check_status` and `type_of` to macro
3. provide #[module_exports] macro
4. remove debug and repr[transparent] for ffi struct
2020-11-26 11:31:49 +08:00
LongYinan
e9fd5d3d40
feat(napi): add abort guard in tsfn methods 2020-11-12 10:47:33 +08:00
LongYinan
eb5f4931bd
feat(napi): impl Clone and Drop for ThreadSafeFunction, return Status from ThreadSafeFunction::call 2020-11-11 16:51:11 +08:00
LongYinan
f3bb57abfb
fix(napi): hanlde unknown enum values from FFI 2020-11-11 14:34:30 +08:00
LongYinan
47f5011a8f feat(napi): support build on i686-pc-windows-msvc 2020-11-04 23:08:54 +08:00
LongYinan
c5f2b6699d
refactor(napi): thread safe function redesign 2020-10-04 17:16:35 +08:00
LongYinan
45411a59ea
feat(napi): implement env cleanup hook 2020-10-04 16:02:04 +08:00
LongYinan
ea3fff25ae
feat(napi): serde-json feature 2020-09-01 23:48:02 +08:00
Michael Orenstein
6b8bd01bcc
Updated threadsafe documentation to mention the first argument error convention 2020-07-26 18:26:42 +09:30
Michael Orenstein
74cd9c49c2
Fixed documentation of threadsafe functions 2020-07-26 17:46:45 +09:30
messense
e7a8cbf26b Rename napi_rs to napi 2020-07-19 17:29:47 +08:00
LongYinan
3508956d16
feat(napi): implement either type 2020-07-18 02:11:49 +08:00
Ouyang Yadong
472d4f2ab5 chore: add into_unknown; refactor tsfn api; add tests for js function 2020-07-04 00:05:31 +08:00
LongYinan
0216c55e54
refactor(napi): redesign the JavaScript values API 2020-06-28 23:29:04 +08:00
Ouyang Yadong
f126a0581f feat(napi): impl threadsafe function api 2020-06-28 22:47:08 +08:00