Skip to content

Commit d89f1cc

Browse files
authored
Optimize VTag construction, memory footprint and patching (#1947)
* yew-macro: optimize VTag construction in html! macro * yew/vtag: decrease VTag memory footpting and construction args * yew,yew-macro: optimize VTag contruction, memory footprint and diffing * yew/vlist: revert to VTag boxing * yew-macro: add clippy allow for nightly rust * yew-macro: fix allow namespace * *: bump MSRV to 1.49.0 * yew/vnode: restore == for VTag comparison * yew/vtag: clean up reference casting * yew-macro/html_element: fix error span regression
1 parent 2412a68 commit d89f1cc

File tree

14 files changed

+839
-466
lines changed

14 files changed

+839
-466
lines changed

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
strategy:
114114
matrix:
115115
toolchain:
116-
- 1.45.0 # MSRV
116+
- 1.49.0 # MSRV
117117
- stable
118118

119119
steps:

Makefile.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ run_task = { name = ["lint-flow"], fork = true }
3636
category = "Testing"
3737
description = "Run all tests"
3838
dependencies = ["tests-setup"]
39-
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*"] }
39+
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*", "**/packages/changelog"] }
4040
run_task = { name = ["test-flow", "doc-test-flow"], fork = true }
4141

4242
[tasks.benchmarks]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<a href="https://docs.rs/yew/"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-yew-green"/></a>
1313
<a href="https://discord.gg/VQck8X4"><img alt="Discord Chat" src="https://img.shields.io/discord/701068342760570933"/></a>
1414
<a href="https://gitlocalize.com/repo/4999/whole_project?utm_source=badge"> <img src="https://gitlocalize.com/repo/4999/whole_project/badge.svg" /> </a>
15-
<a href="https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html"><img alt="Rustc Version 1.45+" src="https://img.shields.io/badge/rustc-1.45%2B-lightgrey.svg"/></a>
15+
<a href="https://blog.rust-lang.org/2020/12/31/Rust-1.49.0.html"><img alt="Rustc Version 1.49.0+" src="https://img.shields.io/badge/rustc-1.49%2B-lightgrey.svg"/></a>
1616
</p>
1717

1818
<h4>

examples/futures/src/markdown.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,20 @@ pub fn render_markdown(src: &str) -> Html {
5353
pre.add_child(top.into());
5454
top = pre;
5555
} else if let Tag::Table(aligns) = tag {
56-
for r in top.children.iter_mut() {
56+
for r in top
57+
.children_mut()
58+
.iter_mut()
59+
.map(|ch| ch.iter_mut())
60+
.flatten()
61+
{
5762
if let VNode::VTag(ref mut vtag) = r {
58-
for (i, c) in vtag.children.iter_mut().enumerate() {
63+
for (i, c) in vtag
64+
.children_mut()
65+
.iter_mut()
66+
.map(|ch| ch.iter_mut())
67+
.flatten()
68+
.enumerate()
69+
{
5970
if let VNode::VTag(ref mut vtag) = c {
6071
match aligns[i] {
6172
Alignment::None => {}
@@ -68,7 +79,12 @@ pub fn render_markdown(src: &str) -> Html {
6879
}
6980
}
7081
} else if let Tag::TableHead = tag {
71-
for c in top.children.iter_mut() {
82+
for c in top
83+
.children_mut()
84+
.iter_mut()
85+
.map(|ch| ch.iter_mut())
86+
.flatten()
87+
{
7288
if let VNode::VTag(ref mut vtag) = c {
7389
// TODO
7490
// vtag.tag = "th".into();

0 commit comments

Comments
 (0)