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: WebIDL derive macro #1003

Merged
merged 35 commits into from
Jan 2, 2025
Merged

Conversation

crowlKats
Copy link
Member

@crowlKats crowlKats commented Dec 16, 2024

  • adds a WebIdlConverter trait
    • implemented for Vec, to have sequence converters
    • implemented for Option, to have nullable converters
    • implemented for HashMap, to have record converters
    • implemented for integers
    • implemented for floats, and creates Unrestricted structs for unrestricted float and unrestricted double
    • implemented for booleans
    • implemented for string
    • creates new ByteString struct for bytestring conversion
    • creates new BigInt struct for bigint conversion
  • adds a WebIDL derive macro, current only allowed on structs as a dictionary converter and on enums as enum converters

@crowlKats crowlKats marked this pull request as draft December 16, 2024 17:01
core/webidl.rs Outdated Show resolved Hide resolved
ops/webidl/mod.rs Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 88.61578% with 176 lines in your changes missing coverage. Please review.

Project coverage is 81.76%. Comparing base (0c7f83e) to head (21b1cd0).
Report is 210 commits behind head on main.

Files with missing lines Patch % Lines
core/webidl.rs 87.38% 125 Missing ⚠️
ops/webidl/dictionary.rs 93.17% 17 Missing ⚠️
ops/op2/dispatch_slow.rs 76.47% 12 Missing ⚠️
ops/webidl/mod.rs 91.97% 11 Missing ⚠️
ops/webidl/enum.rs 90.32% 6 Missing ⚠️
ops/op2/signature.rs 90.47% 4 Missing ⚠️
ops/lib.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1003      +/-   ##
==========================================
+ Coverage   81.43%   81.76%   +0.32%     
==========================================
  Files          97      103       +6     
  Lines       23877    27657    +3780     
==========================================
+ Hits        19445    22613    +3168     
- Misses       4432     5044     +612     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ops/webidl/mod.rs Outdated Show resolved Hide resolved
ops/webidl/mod.rs Outdated Show resolved Hide resolved
ops/webidl/mod.rs Outdated Show resolved Hide resolved
ops/webidl/mod.rs Outdated Show resolved Hide resolved
@crowlKats crowlKats marked this pull request as ready for review January 1, 2025 10:20
Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

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

LGTM! Let's try it out in Deno and iterate based on what's needed.

cc @ry @bartlomieju

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM too, let's try it out.

@crowlKats crowlKats merged commit e373639 into denoland:main Jan 2, 2025
18 checks passed
@crowlKats crowlKats deleted the webidl-converters branch January 2, 2025 12:57
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.

4 participants