Skip to content

Commit

Permalink
Optimize VTag construction, memory footprint and patching (#1947)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bakape authored Jul 18, 2021
1 parent 2412a68 commit d89f1cc
Show file tree
Hide file tree
Showing 14 changed files with 839 additions and 466 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.45.0 # MSRV
- 1.49.0 # MSRV
- stable

steps:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ run_task = { name = ["lint-flow"], fork = true }
category = "Testing"
description = "Run all tests"
dependencies = ["tests-setup"]
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*"] }
env = { CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["**/examples/*", "**/packages/changelog"] }
run_task = { name = ["test-flow", "doc-test-flow"], fork = true }

[tasks.benchmarks]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<a href="https://docs.rs/yew/"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-yew-green"/></a>
<a href="https://discord.gg/VQck8X4"><img alt="Discord Chat" src="https://img.shields.io/discord/701068342760570933"/></a>
<a href="https://gitlocalize.com/repo/4999/whole_project?utm_source=badge"> <img src="https://gitlocalize.com/repo/4999/whole_project/badge.svg" /> </a>
<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>
<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>
</p>

<h4>
Expand Down
22 changes: 19 additions & 3 deletions examples/futures/src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,20 @@ pub fn render_markdown(src: &str) -> Html {
pre.add_child(top.into());
top = pre;
} else if let Tag::Table(aligns) = tag {
for r in top.children.iter_mut() {
for r in top
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
{
if let VNode::VTag(ref mut vtag) = r {
for (i, c) in vtag.children.iter_mut().enumerate() {
for (i, c) in vtag
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
.enumerate()
{
if let VNode::VTag(ref mut vtag) = c {
match aligns[i] {
Alignment::None => {}
Expand All @@ -68,7 +79,12 @@ pub fn render_markdown(src: &str) -> Html {
}
}
} else if let Tag::TableHead = tag {
for c in top.children.iter_mut() {
for c in top
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
{
if let VNode::VTag(ref mut vtag) = c {
// TODO
// vtag.tag = "th".into();
Expand Down
Loading

0 comments on commit d89f1cc

Please sign in to comment.