Skip to content

Conversation

@anonrig
Copy link
Member

@anonrig anonrig commented Dec 22, 2025

This PR introduces a cleaner type conversion system for the JSG/Rust bindings by implementing ToJS and FromJS traits. The main improvement is that JSG methods can now return values directly without requiring Result<T, E> wrappers when no error handling is needed.

Additionally, this PR improves the test harness to return and unwrap correct values which simplifies the tests by a significant margin.

@anonrig anonrig requested a review from mikea December 22, 2025 19:37
@anonrig anonrig requested review from a team as code owners December 22, 2025 19:37
@anonrig anonrig added the rust Pull requests that update rust code label Dec 22, 2025
@anonrig anonrig force-pushed the yagiz/support-non-result-return-vals branch from fa13c8a to 33688a1 Compare December 23, 2025 15:27
@github-actions
Copy link

github-actions bot commented Dec 23, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@anonrig anonrig force-pushed the yagiz/support-non-result-return-vals branch from f1c9bcb to 95722ed Compare December 23, 2025 16:25
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 23, 2025

Merging this PR will not alter performance

Summary

✅ 129 untouched benchmarks
⏩ 49 skipped benchmarks1


Comparing yagiz/support-non-result-return-vals (123ae7e) with main (32d43a0)

Open in CodSpeed

Footnotes

  1. 49 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Contributor

@mikea mikea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think error handling design needs a bit more love.

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would really help to have a clear explanation of the distinction between what types are covered by Type and what types are covered by Wrappable, as it's not clear which set is larger / or if they are disjoint apart from their intersection?

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, in the name of ensuring edge cases, it helps to have tests for cases like Result<Option>, Result<Result, ...> as well when dealing with Result interactions.

@anonrig anonrig force-pushed the yagiz/support-non-result-return-vals branch from 95722ed to 153ece0 Compare January 2, 2026 20:29
@anonrig anonrig requested review from guybedford and mikea January 2, 2026 20:43
@anonrig anonrig force-pushed the yagiz/support-non-result-return-vals branch 2 times, most recently from f5f19ac to a945b9a Compare January 6, 2026 20:46
@anonrig
Copy link
Member Author

anonrig commented Jan 6, 2026

Rebased and force pushed.

@anonrig anonrig force-pushed the yagiz/support-non-result-return-vals branch from 0744afb to 123ae7e Compare January 7, 2026 21:49
@anonrig
Copy link
Member Author

anonrig commented Jan 7, 2026

Rebased and force pushed.

@anonrig anonrig enabled auto-merge (squash) January 7, 2026 22:48
@anonrig anonrig merged commit 872e47b into main Jan 7, 2026
21 of 22 checks passed
@anonrig anonrig deleted the yagiz/support-non-result-return-vals branch January 7, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants