Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(napi) Implement Either3 to Either26. #1200

Merged
merged 2 commits into from
Jul 5, 2022

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Jun 1, 2022

This patch introduces a new macro: either_n! that generates the types
Either{n} where $3 \leq n \leq 26$. Manual implementations for
Either3, Either4 and Either5 are removed by this patch too.

The either_n! macro is quite classical. There is no particular
trick, except count_idents! which simply turns, e.g. A, B, C into
3. This macro is used by either_n! to implement the
debug_assert! inside from_napi_value.

@Hywan Hywan force-pushed the feat-either-n-up-to-26 branch 3 times, most recently from 5c5c6ec to ade6ea8 Compare June 1, 2022 20:29
@Brooooooklyn
Copy link
Member

@Hywan Thank you, but it needs some more refactor on ValidateNapiValue trait; I'll continue the work base on your pull request

@Hywan
Copy link
Contributor Author

Hywan commented Jul 5, 2022

Feel free to iterate on this PR :-).

Hywan and others added 2 commits July 5, 2022 17:01
This patch introduces a new macro: `either_n!` that generates the types
`Either{n}` where $3 \leq n \leq 26$. Manual implementations for
`Either3`, `Either4` and `Either5` are removed by this patch too.

The `either_n!` macro is quite classical. There is no particular
trick, except `count_idents!` which simply turns, e.g. `A, B, C` into
`3`. This macro is used by `either_n!` to implement the
`debug_assert!` inside `from_napi_value`.
@Brooooooklyn Brooooooklyn changed the title feat(napi,backend) Implement Either3 to Either26. feat(napi) Implement Either3 to Either26. Jul 5, 2022
@Brooooooklyn Brooooooklyn merged commit dface0c into napi-rs:main Jul 5, 2022
Hywan added a commit to Hywan/matrix-rust-sdk that referenced this pull request Jul 7, 2022
…ning `Uint8Array`.

The new `napi-rs` release includes a patch that avoids cloning and
copying data inside a `Uint8Array`
(napi-rs/napi-rs#1224), it now returns a
“Node.js reference” of it.

This new `napi-rs` release also includes one of our patch,
napi-rs/napi-rs#1200, which means we no longer
need to depend on our fork.
jplatte pushed a commit to matrix-org/matrix-rust-sdk-crypto-nodejs that referenced this pull request Jul 12, 2023
…ning `Uint8Array`.

The new `napi-rs` release includes a patch that avoids cloning and
copying data inside a `Uint8Array`
(napi-rs/napi-rs#1224), it now returns a
“Node.js reference” of it.

This new `napi-rs` release also includes one of our patch,
napi-rs/napi-rs#1200, which means we no longer
need to depend on our fork.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants