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

Implement IntoPropValue for Rc<str> #2285

Merged
merged 3 commits into from
Dec 21, 2021
Merged

Implement IntoPropValue for Rc<str> #2285

merged 3 commits into from
Dec 21, 2021

Conversation

zstewar1
Copy link
Contributor

Description

Add impl_into_prop! for Rc<str>.

AttrValue already has a variant for Rc<str>, but it's not currently possible to use that in Yew virtual DOM, because that requires IntoPropValue<Option<AttrValue>> which isn't implemented. This change adds a set of those implementations using the existing macro.

Checklist

  • I have run cargo make pr-flow
  • I have reviewed my own code
  • I have added tests
    • If this is a feature, my tests prove that the feature works: yes, at least as well as the existing tests prove it works for String and &'static str.

@voidpumpkin voidpumpkin added the A-yew Area: The main yew crate label Dec 19, 2021
@ranile
Copy link
Member

ranile commented Dec 19, 2021

Looks good. I'll approve it once CI is green. I have no idea why it's failing though. You can try merging master into your branch. If that doesn't do it, try running cargo update -p trybuild and then run cargo make tests-overwrite in yew-macro directory. You'll need cargo-make and Rust 1.51 installed for this.

@zstewar1
Copy link
Contributor Author

There's a test checking that certain builds fail as expected, and it does a comparison of the exact expected log output. A couple of those lines include listing the number of impls of a certain type, and this PR adds 3 more impls. I'll re-run with the suggested command to bless the new logs later.

--- expected.txt	2021-12-20 08:11:30.847616078 -0500
+++ actual.txt	2021-12-20 08:12:39.514969912 -0500
@@ -344,11 +344,11 @@
    = help: the following implementations were found:
              <&'static str as IntoPropValue<AttrValue>>
              <&'static str as IntoPropValue<Classes>>
              <&'static str as IntoPropValue<Option<AttrValue>>>
              <&'static str as IntoPropValue<Option<String>>>
-           and 12 others
+           and 15 others
 
 error[E0277]: the trait bound `{integer}: IntoPropValue<String>` is not satisfied
 ##[error]  --> tests/html_macro/component-fail.rs:79:34
    |
 79 |     html! { <Child int=1 string={3} /> };
@@ -357,11 +357,11 @@
    = help: the following implementations were found:
              <&'static str as IntoPropValue<AttrValue>>
              <&'static str as IntoPropValue<Classes>>
              <&'static str as IntoPropValue<Option<AttrValue>>>
              <&'static str as IntoPropValue<Option<String>>>
-           and 12 others
+           and 15 others
 
 error[E0308]: mismatched types
 ##[error]  --> tests/html_macro/component-fail.rs:80:31
    |
 80 |     html! { <Child int=1 ref={()} /> };

@zstewar1
Copy link
Contributor Author

Updated logs-tests.

@ranile ranile merged commit a166815 into yewstack:master Dec 21, 2021
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants