diff --git a/packages/yew-macro/tests/html_macro/element-fail.stderr b/packages/yew-macro/tests/html_macro/element-fail.stderr index 6066546ee..4ce990ed9 100644 --- a/packages/yew-macro/tests/html_macro/element-fail.stderr +++ b/packages/yew-macro/tests/html_macro/element-fail.stderr @@ -302,11 +302,11 @@ error[E0277]: the trait bound `Option<{integer}>: IntoPropValue as IntoPropValue>>> = note: required by `into_prop_value` -error[E0277]: the trait bound `{integer}: IntoPropValue>>` is not satisfied +error[E0277]: expected a `Fn<(MouseEvent,)>` closure, found `{integer}` --> $DIR/element-fail.rs:51:28 | 51 | html! { }; - | ^ the trait `IntoPropValue>>` is not implemented for `{integer}` + | ^ expected an `Fn<(MouseEvent,)>` closure, found `{integer}` | ::: $WORKSPACE/packages/yew/src/html/listener/events.rs | @@ -319,18 +319,17 @@ error[E0277]: the trait bound `{integer}: IntoPropValue>> - <&'static str as IntoPropValue>>> - <&'static str as IntoPropValue>> - <&'static str as IntoPropValue> - and 11 others + = help: the trait `Fn<(MouseEvent,)>` is not implemented for `{integer}` + = note: required because of the requirements on the impl of `IntoEventCallback` for `{integer}` -error[E0277]: the trait bound `yew::Callback: IntoPropValue>>` is not satisfied +error[E0277]: expected a `Fn<(MouseEvent,)>` closure, found `yew::Callback` --> $DIR/element-fail.rs:52:29 | 52 | html! { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoPropValue>>` is not implemented for `yew::Callback` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected an implementor of trait `IntoEventCallback` + | help: consider borrowing here: `&Callback::from(|a: String| ())` | ::: $WORKSPACE/packages/yew/src/html/listener/events.rs | @@ -342,12 +341,15 @@ error[E0277]: the trait bound `yew::Callback: IntoPropValue: IntoEventCallback` is not satisfied + = note: required because of the requirements on the impl of `IntoEventCallback` for `yew::Callback` -error[E0277]: the trait bound `Option<{integer}>: IntoPropValue>>` is not satisfied +error[E0277]: the trait bound `Option<{integer}>: IntoEventCallback` is not satisfied --> $DIR/element-fail.rs:53:29 | 53 | html! { }; - | ^^^^^^^ the trait `IntoPropValue>>` is not implemented for `Option<{integer}>` + | ^^^^^^^ the trait `IntoEventCallback` is not implemented for `Option<{integer}>` | ::: $WORKSPACE/packages/yew/src/html/listener/events.rs | @@ -361,9 +363,8 @@ error[E0277]: the trait bound `Option<{integer}>: IntoPropValue as IntoPropValue>>> - as IntoPropValue>> - as IntoPropValue>>> + as IntoEventCallback> + > as IntoEventCallback> error[E0277]: the trait bound `(): IntoPropValue` is not satisfied --> $DIR/element-fail.rs:56:25 @@ -385,11 +386,14 @@ error[E0277]: the trait bound `Option: IntoPropValue as IntoPropValue>>> = note: required by `into_prop_value` -error[E0277]: the trait bound `yew::Callback: IntoPropValue>>` is not satisfied +error[E0277]: expected a `Fn<(MouseEvent,)>` closure, found `yew::Callback` --> $DIR/element-fail.rs:58:29 | 58 | html! { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoPropValue>>` is not implemented for `yew::Callback` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected an implementor of trait `IntoEventCallback` + | help: consider borrowing here: `&Callback::from(|a: String| ())` | ::: $WORKSPACE/packages/yew/src/html/listener/events.rs | @@ -401,6 +405,9 @@ error[E0277]: the trait bound `yew::Callback: IntoPropValue: IntoEventCallback` is not satisfied + = note: required because of the requirements on the impl of `IntoEventCallback` for `yew::Callback` error[E0277]: the trait bound `NotToString: IntoPropValue>>` is not satisfied --> $DIR/element-fail.rs:60:28 diff --git a/packages/yew/src/html/listener/events.rs b/packages/yew/src/html/listener/events.rs index 516ad62bc..db11fd8d1 100644 --- a/packages/yew/src/html/listener/events.rs +++ b/packages/yew/src/html/listener/events.rs @@ -27,9 +27,9 @@ macro_rules! impl_action { #[doc(hidden)] #[inline] pub fn __macro_new( - callback: impl crate::html::IntoPropValue>>, + callback: impl crate::html::IntoEventCallback, ) -> Option> { - let callback = callback.into_prop_value()?; + let callback = callback.into_event_callback()?; Some(Rc::new(Self::new(callback))) } }