chinedufn / percy

Build frontend browser apps with Rust + WebAssembly. Supports server side rendering.
https://chinedufn.github.io/percy/
Apache License 2.0
2.26k stars 84 forks source link

Fix readme example and missing Rc import #86

Closed alexkehayias closed 5 years ago

alexkehayias commented 5 years ago

About

Fixes warning that import of Cell is unused and compilation failed due to use of undeclared type or module Rc.

Using rustc 1.34.0-nightly (146aa60f3 2019-02-18) and the dependencies listed in the readme.

chinedufn commented 5 years ago

@alexkehayias thanks for fixing this!

So the issue with the Rc is due to a silly mistake right here:

https://github.com/chinedufn/percy/blob/ad82711fbfb56a7c1486deb70abb27cbb3e4667a/crates/html-macro/src/parser.rs#L87

Mind just replacing that Rc with std::rc::Rc and then we can ditch needing to use Rc in the README example?


Some additional context.

We store closures as Rc<dyn AsRef<JsValue>>

https://github.com/chinedufn/percy/blob/feac8f20d3d0572e8a658e17d2231c47ea741de8/crates/virtual-node/src/lib.rs#L450

So the html! macro uses Rc when it sees a closure, in the README's case it was onclick.


Thanks again for spotting this!

alexkehayias commented 5 years ago

@chinedufn done, I ran the tests via ./tests.sh and the output look 👍

chinedufn commented 5 years ago

Looking CLEAN - thanks again!