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: make async functions send+sync #38

Merged
merged 2 commits into from
Dec 10, 2024
Merged

feat: make async functions send+sync #38

merged 2 commits into from
Dec 10, 2024

Conversation

ccbrown
Copy link
Owner

@ccbrown ccbrown commented Dec 10, 2024

What It Does

This makes it possible to use iocraft futures where Send is required.

The downside is it requires all Props implementations and all context to be Send + Sync. In reality, what sorts of use-cases would this actually negatively impact?

Relevant: async-graphql/async-graphql#1122

The question is probably whether this should be merged as-is or gated behind a feature flag.

Related Issues

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.11%. Comparing base (7a1b364) to head (477f40f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/iocraft/src/render.rs 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
- Coverage   91.14%   91.11%   -0.04%     
==========================================
  Files          23       23              
  Lines        3445     3444       -1     
  Branches     3445     3444       -1     
==========================================
- Hits         3140     3138       -2     
  Misses        238      238              
- Partials       67       68       +1     
Files with missing lines Coverage Δ
packages/iocraft-macros/src/lib.rs 95.72% <ø> (ø)
packages/iocraft/src/component.rs 90.72% <ø> (ø)
packages/iocraft/src/context.rs 88.46% <100.00%> (ø)
packages/iocraft/src/element.rs 69.79% <100.00%> (ø)
packages/iocraft/src/handler.rs 90.00% <ø> (ø)
packages/iocraft/src/hook.rs 95.77% <ø> (ø)
packages/iocraft/src/hooks/use_async_handler.rs 93.02% <100.00%> (ø)
packages/iocraft/src/props.rs 100.00% <ø> (ø)
packages/iocraft/src/terminal.rs 72.61% <ø> (ø)
packages/iocraft/src/render.rs 95.60% <75.00%> (-0.29%) ⬇️

Impacted file tree graph

@ccbrown
Copy link
Owner Author

ccbrown commented Dec 10, 2024

After some more thought, I couldn't think of a realistic use-case in which this would be a problem, so I'm going to merge without a feature flag.

If anyone encounters one, please let me know. I would be willing to make this opt-out if there's a compelling use-case. And as a workaround, https://crates.io/crates/send_wrapper can always be used.

@ccbrown ccbrown merged commit 40b4692 into main Dec 10, 2024
5 checks passed
@ccbrown ccbrown deleted the send-sync branch December 10, 2024 23:02
@github-actions github-actions bot mentioned this pull request Dec 10, 2024
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.

Async support (Send compatible)?
1 participant