Implement IntoPropValue for Rc<str> (#2285)

* add IntoPropValue implementations for Rc<str>

* add test

* update test logs which record the new impls
This commit is contained in:
Zachary Stewart 2021-12-21 15:42:26 -05:00 committed by GitHub
parent 75864e8ae5
commit a166815b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -346,7 +346,7 @@ error[E0277]: the trait bound `{integer}: IntoPropValue<String>` is not satisfie
<&'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
--> tests/html_macro/component-fail.rs:79:34
@ -359,7 +359,7 @@ error[E0277]: the trait bound `{integer}: IntoPropValue<String>` is not satisfie
<&'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
--> tests/html_macro/component-fail.rs:80:31

View File

@ -288,6 +288,7 @@ error[E0277]: the trait bound `Option<NotToString>: IntoPropValue<Option<AttrVal
<Option<&'static str> as IntoPropValue<Option<AttrValue>>>
<Option<&'static str> as IntoPropValue<Option<String>>>
<Option<String> as IntoPropValue<Option<AttrValue>>>
<Option<std::rc::Rc<str>> as IntoPropValue<Option<AttrValue>>>
= note: required by `into_prop_value`
error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<AttrValue>>` is not satisfied
@ -300,6 +301,7 @@ error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<AttrValue
<Option<&'static str> as IntoPropValue<Option<AttrValue>>>
<Option<&'static str> as IntoPropValue<Option<String>>>
<Option<String> as IntoPropValue<Option<AttrValue>>>
<Option<std::rc::Rc<str>> as IntoPropValue<Option<AttrValue>>>
= note: required by `into_prop_value`
error[E0277]: expected a `Fn<(MouseEvent,)>` closure, found `{integer}`
@ -384,6 +386,7 @@ error[E0277]: the trait bound `Option<yew::NodeRef>: IntoPropValue<yew::NodeRef>
<Option<&'static str> as IntoPropValue<Option<AttrValue>>>
<Option<&'static str> as IntoPropValue<Option<String>>>
<Option<String> as IntoPropValue<Option<AttrValue>>>
<Option<std::rc::Rc<str>> as IntoPropValue<Option<AttrValue>>>
= note: required by `into_prop_value`
error[E0277]: expected a `Fn<(MouseEvent,)>` closure, found `yew::Callback<String>`

View File

@ -86,6 +86,7 @@ impl_into_prop!(|value: &'static str| -> String { value.to_owned() });
impl_into_prop!(|value: &'static str| -> AttrValue { AttrValue::Static(value) });
impl_into_prop!(|value: String| -> AttrValue { AttrValue::Owned(value) });
impl_into_prop!(|value: Rc<str>| -> AttrValue { AttrValue::Rc(value) });
#[cfg(test)]
mod test {
@ -97,5 +98,6 @@ mod test {
let _: Option<String> = "foo".into_prop_value();
let _: AttrValue = "foo".into_prop_value();
let _: Option<AttrValue> = "foo".into_prop_value();
let _: Option<AttrValue> = Rc::<str>::from("foo").into_prop_value();
}
}