Skip to content

Leverage Rust 1.78-1.84 APIs #4107

Merged
Madoshakalaka merged 7 commits intomasterfrom
refactor/leverage-new-rust-apis
Apr 4, 2026
Merged

Leverage Rust 1.78-1.84 APIs #4107
Madoshakalaka merged 7 commits intomasterfrom
refactor/leverage-new-rust-apis

Conversation

@Madoshakalaka
Copy link
Copy Markdown
Member

@Madoshakalaka Madoshakalaka commented Apr 3, 2026

Description

this is a follow up to #3900, which bumped the MSRV but didn't fully utilize the new rust APIs.

Checklist

  • I have reviewed my own code

@Madoshakalaka Madoshakalaka added performance A-yew Area: The main yew crate A-yew-macro Area: The yew-macro crate labels Apr 3, 2026
@Madoshakalaka
Copy link
Copy Markdown
Member Author

Breaking public API change: pub fn set_custom_panic_hook now takes Box<dyn Fn(&PanicHookInfo<'_>) + ...> instead of the deprecated PanicInfo.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

Benchmark - core

Yew Master

vnode           fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ vnode_clone  2.155 ns      │ 2.787 ns      │ 2.157 ns      │ 2.169 ns      │ 100     │ 1000000000

Pull Request

vnode           fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ vnode_clone  2.715 ns      │ 4.113 ns      │ 3.961 ns      │ 3.619 ns      │ 100     │ 1000000000

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

Visit the preview URL for this PR (updated for commit 8b3b25e):

https://yew-rs-api--pr4107-refactor-leverage-ne-th4cytut.web.app

(expires Sat, 11 Apr 2026 10:53:58 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@Madoshakalaka Madoshakalaka changed the title Refactor/leverage new rust apis Leverage some Rust 1.78-1.84 APIs Apr 3, 2026
@Madoshakalaka Madoshakalaka changed the title Leverage some Rust 1.78-1.84 APIs Leverage Rust 1.78-1.84 APIs Apr 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

Size Comparison

Details
examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 100.817 99.940 -0.877 -0.870%
boids 168.471 167.611 -0.859 -0.510%
communication_child_to_parent 94.097 93.237 -0.859 -0.913%
communication_grandchild_with_grandparent 105.920 105.057 -0.863 -0.815%
communication_grandparent_to_grandchild 102.276 101.408 -0.868 -0.849%
communication_parent_to_child 91.507 90.647 -0.859 -0.939%
contexts 105.979 105.114 -0.864 -0.816%
counter 86.818 85.941 -0.877 -1.010%
counter_functional 88.854 87.976 -0.879 -0.989%
dyn_create_destroy_apps 90.733 89.864 -0.869 -0.958%
file_upload 99.832 98.950 -0.882 -0.883%
function_delayed_input 94.813 93.934 -0.880 -0.928%
function_memory_game 173.688 172.829 -0.858 -0.494%
function_router 397.049 396.147 -0.901 -0.227%
function_todomvc 164.923 164.056 -0.867 -0.526%
futures 235.551 234.664 -0.887 -0.376%
game_of_life 105.053 104.172 -0.881 -0.838%
immutable 259.783 257.888 -1.896 -0.730%
inner_html 81.341 80.464 -0.877 -1.078%
js_callback 109.977 109.078 -0.898 -0.817%
keyed_list 180.429 179.569 -0.859 -0.476%
mount_point 84.713 83.833 -0.880 -1.039%
nested_list 113.634 112.745 -0.889 -0.782%
node_refs 92.085 91.226 -0.859 -0.933%
password_strength 1719.265 1718.400 -0.864 -0.050%
portals 93.571 92.711 -0.860 -0.919%
router 367.937 367.035 -0.901 -0.245%
suspense 113.959 113.065 -0.894 -0.784%
timer 88.964 88.079 -0.885 -0.995%
timer_functional 99.346 98.479 -0.867 -0.873%
todomvc 142.639 141.760 -0.879 -0.616%
two_apps 86.688 85.805 -0.884 -1.020%
web_worker_fib 136.449 135.566 -0.883 -0.647%
web_worker_prime 184.835 183.952 -0.883 -0.478%
webgl 83.485 82.605 -0.880 -1.054%

⚠️ The following examples have changed their size significantly:

examples master (KB) pull request (KB) diff (KB) diff (%)
counter 86.818 85.941 -0.877 -1.010%
inner_html 81.341 80.464 -0.877 -1.078%
mount_point 84.713 83.833 -0.880 -1.039%
two_apps 86.688 85.805 -0.884 -1.020%
webgl 83.485 82.605 -0.880 -1.054%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

Benchmark - SSR

Yew Master

Details
Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 346.824 347.419 347.075 0.172
Hello World 10 481.901 492.972 487.224 3.251
Function Router 10 30240.492 31432.934 30902.776 411.793
Concurrent Task 10 1006.517 1007.863 1007.257 0.528
Many Providers 10 1092.338 1448.646 1160.963 108.876

Pull Request

Details
Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 302.642 303.287 302.900 0.183
Hello World 10 483.542 490.708 486.560 2.160
Function Router 10 29625.223 30919.993 30424.405 399.349
Concurrent Task 10 1006.261 1008.135 1007.361 0.686
Many Providers 10 1043.812 1080.959 1057.215 11.545

@Madoshakalaka
Copy link
Copy Markdown
Member Author

6d7b8f2 is a bug fix worth mentioning in the changelog

@Madoshakalaka Madoshakalaka added the A-yew-agent Area: The yew-agent crate label Apr 3, 2026
@Madoshakalaka
Copy link
Copy Markdown
Member Author

2a6a575 is a breaking change but requires no action from most users I imagine. Because likely nobody constructs AttributeOrProperty manually.

@Madoshakalaka Madoshakalaka force-pushed the refactor/leverage-new-rust-apis branch from 2a6a575 to 81eac3b Compare April 4, 2026 10:48
- Use Option::is_none_or (1.82) replacing match/map+unwrap_or patterns
- Use inline const {} blocks (1.79) in VList::deref and thread_local! inits
- Remove stale #[allow(ambiguous_wide_pointer_comparisons)] on Rc::ptr_eq (1.84)
- Remove #[allow(clippy::incompatible_msrv)] and PanicInfo alias, use PanicHookInfo directly (1.81)
- Remove redundant prelude imports (size_of, FromIterator, PartialEq)
Add const fn new() to FifoQueue, TopologicalQueue, and Scheduler so
the SCHEDULER thread_local can use const {} initialization, eliminating
the lazy-init check on every access to this hot-path global.
…essions

Convert active lint suppressions to #[expect] so the compiler warns if
they become unnecessary. Remove 7 stale #[allow] attributes that were
never firing (too_many_arguments on <7-param functions, cognitive_complexity,
large_enum_variant, let_with_type_underscore, missing_debug_implementations
on private types, and missing_docs on doc-hidden items).
Replace .finish() with .finish_non_exhaustive() and f.write_str("Type")
with f.debug_struct("Type").finish_non_exhaustive() across all Debug
implementations that intentionally hide fields. This produces more
accurate debug output (e.g. "Type { .. }" instead of "Type {}").

Also fixes a naming bug in WorkerSpawner's Debug impl which incorrectly
printed "WorkerScope<_>" instead of "WorkerSpawner<_>".
BREAKING CHANGE: removed the `Static` variant from the public
`AttributeOrProperty` enum.
@Madoshakalaka Madoshakalaka force-pushed the refactor/leverage-new-rust-apis branch from 81eac3b to 8b3b25e Compare April 4, 2026 10:51
@Madoshakalaka Madoshakalaka marked this pull request as ready for review April 4, 2026 12:06
@Madoshakalaka Madoshakalaka merged commit f349778 into master Apr 4, 2026
37 checks passed
@Madoshakalaka Madoshakalaka deleted the refactor/leverage-new-rust-apis branch April 4, 2026 23:10
shan-shaji pushed a commit to shan-shaji/yew that referenced this pull request Apr 19, 2026
* refactor: leverage some Rust 1.78-1.84 APIs

- Use Option::is_none_or (1.82) replacing match/map+unwrap_or patterns
- Use inline const {} blocks (1.79) in VList::deref and thread_local! inits
- Remove stale #[allow(ambiguous_wide_pointer_comparisons)] on Rc::ptr_eq (1.84)
- Remove #[allow(clippy::incompatible_msrv)] and PanicInfo alias, use PanicHookInfo directly (1.81)
- Remove redundant prelude imports (size_of, FromIterator, PartialEq)

* refactor: const-init SCHEDULER thread_local via const fn constructors

Add const fn new() to FifoQueue, TopologicalQueue, and Scheduler so
the SCHEDULER thread_local can use const {} initialization, eliminating
the lazy-init check on every access to this hot-path global.

* refactor: replace #[allow] with #[expect] and remove stale lint suppressions

Convert active lint suppressions to #[expect] so the compiler warns if
they become unnecessary. Remove 7 stale #[allow] attributes that were
never firing (too_many_arguments on <7-param functions, cognitive_complexity,
large_enum_variant, let_with_type_underscore, missing_debug_implementations
on private types, and missing_docs on doc-hidden items).

* fix: preserve #[expect] attributes in derive(Properties) macro expansion

* refactor: use finish_non_exhaustive() in Debug impls with hidden fields

Replace .finish() with .finish_non_exhaustive() and f.write_str("Type")
with f.debug_struct("Type").finish_non_exhaustive() across all Debug
implementations that intentionally hide fields. This produces more
accurate debug output (e.g. "Type { .. }" instead of "Type {}").

* refactor: use associated type bounds to simplify where clauses

* refactor!: remove AttributeOrProperty::Static workaround for Rust <1.72

BREAKING CHANGE: removed the `Static` variant from the public
`AttributeOrProperty` enum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-yew Area: The main yew crate A-yew-agent Area: The yew-agent crate A-yew-macro Area: The yew-macro crate breaking change performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant