-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli,napi-derive): re-export types from shared crate
- Loading branch information
1 parent
3b831f4
commit 649601f
Showing
13 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
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
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,22 @@ | ||
[package] | ||
authors = ["LongYinan <lynweklm@gmail.com>"] | ||
edition = "2021" | ||
name = "napi-shared" | ||
publish = false | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
napi = { path = "../../crates/napi", default-features = false, features = [ | ||
"tokio_fs", | ||
"napi8", | ||
"tokio_rt", | ||
"serde-json", | ||
"async", | ||
"experimental", | ||
"latin1", | ||
"chrono_date", | ||
] } | ||
napi-derive = { path = "../../crates/macro", features = ["type-def"] } | ||
|
||
[build-dependencies] | ||
napi-build = { path = "../../crates/build" } |
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,6 @@ | ||
use napi_derive::napi; | ||
|
||
#[napi(object)] | ||
pub struct Shared { | ||
pub value: u32, | ||
} |
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
Binary file not shown.
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 |
---|---|---|
|
@@ -43,6 +43,7 @@ mod object; | |
mod promise; | ||
mod reference; | ||
mod serde; | ||
mod shared; | ||
mod string; | ||
mod symbol; | ||
mod task; | ||
|
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_derive::napi; | ||
use napi_shared::Shared; | ||
|
||
#[napi] | ||
pub fn return_from_shared_crate() -> Shared { | ||
Shared { value: 42 } | ||
} |
649601f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
noop#napi-rs
63029175
ops/sec (±0.44%
)49256299
ops/sec (±1.23%
)0.78
noop#JavaScript
710236800
ops/sec (±0.15%
)729666474
ops/sec (±0.95%
)1.03
Plus number#napi-rs
18644731
ops/sec (±0.26%
)14677733
ops/sec (±0.96%
)0.79
Plus number#JavaScript
706630396
ops/sec (±0.3%
)696004559
ops/sec (±1.06%
)0.98
Create buffer#napi-rs
374687
ops/sec (±10.61%
)316631
ops/sec (±9.79%
)0.85
Create buffer#JavaScript
1877453
ops/sec (±8.21%
)1472552
ops/sec (±6.88%
)0.78
createArray#createArrayJson
39440
ops/sec (±0.55%
)32700
ops/sec (±0.99%
)0.83
createArray#create array for loop
7503
ops/sec (±0.12%
)6001
ops/sec (±0.88%
)0.80
createArray#create array with serde trait
7522
ops/sec (±0.12%
)6151
ops/sec (±0.77%
)0.82
getArrayFromJs#get array from json string
16611
ops/sec (±0.45%
)14300
ops/sec (±0.95%
)0.86
getArrayFromJs#get array from serde
10269
ops/sec (±0.03%
)8369
ops/sec (±1.05%
)0.81
getArrayFromJs#get array with for loop
12612
ops/sec (±0.08%
)10193
ops/sec (±1.25%
)0.81
Get Set property#Get Set from native#u32
426650
ops/sec (±9.59%
)387711
ops/sec (±8.4%
)0.91
Get Set property#Get Set from JavaScript#u32
379461
ops/sec (±10.79%
)341191
ops/sec (±9.69%
)0.90
Get Set property#Get Set from native#string
401215
ops/sec (±17.54%
)371833
ops/sec (±4.07%
)0.93
Get Set property#Get Set from JavaScript#string
381228
ops/sec (±3.91%
)310627
ops/sec (±14.99%
)0.81
Async task#spawn task
37246
ops/sec (±1%
)27194
ops/sec (±3.62%
)0.73
Async task#ThreadSafeFunction
2009
ops/sec (±13.46%
)1493
ops/sec (±3.3%
)0.74
Async task#Tokio future to Promise
33357
ops/sec (±1.28%
)27053
ops/sec (±2%
)0.81
Query#query * 100
2096
ops/sec (±2.55%
)1546
ops/sec (±2.17%
)0.74
Query#query * 1
31844
ops/sec (±0.48%
)21866
ops/sec (±2.53%
)0.69
This comment was automatically generated by workflow using github-action-benchmark.