mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Update tests
This commit is contained in:
parent
23c23d74ec
commit
5c367d2c6a
@ -9,13 +9,13 @@ pub struct ChildProperties {
|
|||||||
pub int: i32,
|
pub int: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ChildComponent;
|
pub struct Child;
|
||||||
impl Component for ChildComponent {
|
impl Component for Child {
|
||||||
type Message = ();
|
type Message = ();
|
||||||
type Properties = ChildProperties;
|
type Properties = ChildProperties;
|
||||||
|
|
||||||
fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self {
|
fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self {
|
||||||
ChildComponent
|
Child
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
||||||
@ -23,33 +23,63 @@ impl Component for ChildComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Renderable<ChildComponent> for ChildComponent {
|
impl Renderable<Self> for Child {
|
||||||
|
fn view(&self) -> Html<Self> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Properties)]
|
||||||
|
pub struct ChildContainerProperties {
|
||||||
|
pub children: ChildrenWithProps<Child, ChildContainer>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ChildContainer;
|
||||||
|
impl Component for ChildContainer {
|
||||||
|
type Message = ();
|
||||||
|
type Properties = ChildContainerProperties;
|
||||||
|
|
||||||
|
fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self {
|
||||||
|
ChildContainer
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Renderable<Self> for ChildContainer {
|
||||||
fn view(&self) -> Html<Self> {
|
fn view(&self) -> Html<Self> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_fail() {
|
fn compile_fail() {
|
||||||
html! { <ChildComponent> };
|
html! { <Child> };
|
||||||
html! { <ChildComponent:: /> };
|
html! { <Child:: /> };
|
||||||
html! { <ChildComponent with /> };
|
html! { <Child with /> };
|
||||||
html! { <ChildComponent props /> };
|
html! { <Child props /> };
|
||||||
html! { <ChildComponent with props > };
|
html! { <Child with props > };
|
||||||
html! { <ChildComponent with blah /> };
|
html! { <Child with blah /> };
|
||||||
html! { <ChildComponent with props () /> };
|
html! { <Child with props () /> };
|
||||||
html! { <ChildComponent type=0 /> };
|
html! { <Child type=0 /> };
|
||||||
html! { <ChildComponent invalid-prop-name=0 /> };
|
html! { <Child invalid-prop-name=0 /> };
|
||||||
html! { <ChildComponent unknown="unknown" /> };
|
html! { <Child unknown="unknown" /> };
|
||||||
html! { <ChildComponent string= /> };
|
html! { <Child string= /> };
|
||||||
html! { <ChildComponent int=1 string={} /> };
|
html! { <Child int=1 string={} /> };
|
||||||
html! { <ChildComponent int=1 string=3 /> };
|
html! { <Child int=1 string=3 /> };
|
||||||
html! { <ChildComponent int=1 string={3} /> };
|
html! { <Child int=1 string={3} /> };
|
||||||
html! { <ChildComponent int=0u32 /> };
|
html! { <Child int=0u32 /> };
|
||||||
html! { <ChildComponent string="abc" /> };
|
html! { <Child string="abc" /> };
|
||||||
html! { </ChildComponent> };
|
html! { </Child> };
|
||||||
html! { <ChildComponent><ChildComponent></ChildComponent> };
|
html! { <Child><Child></Child> };
|
||||||
html! { <ChildComponent></ChildComponent><ChildComponent></ChildComponent> };
|
html! { <Child></Child><Child></Child> };
|
||||||
html! { <ChildComponent>{ "Not allowed" }</ChildComponent> };
|
html! { <Child>{ "Not allowed" }</Child> };
|
||||||
|
html! { <ChildContainer>{ "Not allowed" }</ChildContainer> };
|
||||||
|
html! { <ChildContainer><></></ChildContainer> };
|
||||||
|
html! { <ChildContainer><ChildContainer /></ChildContainer> };
|
||||||
|
html! { <ChildContainer><ChildContainer /></ChildContainer> };
|
||||||
|
html! { <ChildContainer><Child int=1 /><other /></ChildContainer> };
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|||||||
@ -1,186 +1,231 @@
|
|||||||
error: this open tag has no corresponding close tag
|
error: this open tag has no corresponding close tag
|
||||||
--> $DIR/html-component-fail.rs:33:13
|
--> $DIR/html-component-fail.rs:58:13
|
||||||
|
|
|
|
||||||
33 | html! { <ChildComponent> };
|
58 | html! { <Child> };
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: expected identifier
|
error: expected identifier
|
||||||
--> $DIR/html-component-fail.rs:34:31
|
--> $DIR/html-component-fail.rs:59:22
|
||||||
|
|
|
|
||||||
34 | html! { <ChildComponent:: /> };
|
59 | html! { <Child:: /> };
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
error: this open tag has no corresponding close tag
|
error: this open tag has no corresponding close tag
|
||||||
--> $DIR/html-component-fail.rs:37:13
|
--> $DIR/html-component-fail.rs:62:13
|
||||||
|
|
|
|
||||||
37 | html! { <ChildComponent with props > };
|
62 | html! { <Child with props > };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: expected type, found `/`
|
error: expected type, found `/`
|
||||||
--> $DIR/html-component-fail.rs:49:14
|
--> $DIR/html-component-fail.rs:74:14
|
||||||
|
|
|
|
||||||
49 | html! { </ChildComponent> };
|
74 | html! { </Child> };
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
error: this open tag has no corresponding close tag
|
error: this open tag has no corresponding close tag
|
||||||
--> $DIR/html-component-fail.rs:50:13
|
--> $DIR/html-component-fail.rs:75:13
|
||||||
|
|
|
|
||||||
50 | html! { <ChildComponent><ChildComponent></ChildComponent> };
|
75 | html! { <Child><Child></Child> };
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: only one root html element allowed
|
error: only one root html element allowed
|
||||||
--> $DIR/html-component-fail.rs:51:46
|
--> $DIR/html-component-fail.rs:76:28
|
||||||
|
|
|
|
||||||
51 | html! { <ChildComponent></ChildComponent><ChildComponent></ChildComponent> };
|
76 | html! { <Child></Child><Child></Child> };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0425]: cannot find value `blah` in this scope
|
error[E0425]: cannot find value `blah` in this scope
|
||||||
--> $DIR/html-component-fail.rs:38:34
|
--> $DIR/html-component-fail.rs:63:25
|
||||||
|
|
|
|
||||||
38 | html! { <ChildComponent with blah /> };
|
63 | html! { <Child with blah /> };
|
||||||
| ^^^^ not found in this scope
|
| ^^^^ not found in this scope
|
||||||
|
|
||||||
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
--> $DIR/html-component-fail.rs:35:5
|
--> $DIR/html-component-fail.rs:60:5
|
||||||
|
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
5 | #[derive(Properties, PartialEq)]
|
||||||
| - method `build` not found for this
|
| - method `build` not found for this
|
||||||
...
|
...
|
||||||
35 | html! { <ChildComponent with /> };
|
60 | html! { <Child with /> };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
|
--> $DIR/html-component-fail.rs:61:5
|
||||||
|
|
|
||||||
|
5 | #[derive(Properties, PartialEq)]
|
||||||
|
| - method `build` not found for this
|
||||||
|
...
|
||||||
|
61 | html! { <Child props /> };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
|
--> $DIR/html-component-fail.rs:64:5
|
||||||
|
|
|
||||||
|
5 | #[derive(Properties, PartialEq)]
|
||||||
|
| - method `build` not found for this
|
||||||
|
...
|
||||||
|
64 | html! { <Child with props () /> };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
--> $DIR/html-component-fail.rs:36:5
|
--> $DIR/html-component-fail.rs:65:5
|
||||||
|
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
5 | #[derive(Properties, PartialEq)]
|
||||||
| - method `build` not found for this
|
| - method `build` not found for this
|
||||||
...
|
...
|
||||||
36 | html! { <ChildComponent props /> };
|
65 | html! { <Child type=0 /> };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
--> $DIR/html-component-fail.rs:39:5
|
--> $DIR/html-component-fail.rs:66:5
|
||||||
|
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
5 | #[derive(Properties, PartialEq)]
|
||||||
| - method `build` not found for this
|
| - method `build` not found for this
|
||||||
...
|
...
|
||||||
39 | html! { <ChildComponent with props () /> };
|
66 | html! { <Child invalid-prop-name=0 /> };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
||||||
|
|
||||||
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
|
||||||
--> $DIR/html-component-fail.rs:40:5
|
|
||||||
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
|
||||||
| - method `build` not found for this
|
|
||||||
...
|
|
||||||
40 | html! { <ChildComponent type=0 /> };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
|
||||||
|
|
||||||
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
|
||||||
--> $DIR/html-component-fail.rs:41:5
|
|
||||||
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
|
||||||
| - method `build` not found for this
|
|
||||||
...
|
|
||||||
41 | html! { <ChildComponent invalid-prop-name=0 /> };
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0609]: no field `unknown` on type `ChildProperties`
|
error[E0609]: no field `unknown` on type `ChildProperties`
|
||||||
--> $DIR/html-component-fail.rs:42:29
|
--> $DIR/html-component-fail.rs:67:20
|
||||||
|
|
|
|
||||||
42 | html! { <ChildComponent unknown="unknown" /> };
|
67 | html! { <Child unknown="unknown" /> };
|
||||||
| ^^^^^^^ unknown field
|
| ^^^^^^^ unknown field
|
||||||
|
|
|
|
||||||
= note: available fields are: `string`, `int`
|
= note: available fields are: `string`, `int`
|
||||||
|
|
||||||
error[E0599]: no method named `unknown` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
error[E0599]: no method named `unknown` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
--> $DIR/html-component-fail.rs:42:29
|
--> $DIR/html-component-fail.rs:67:20
|
||||||
|
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
5 | #[derive(Properties, PartialEq)]
|
||||||
| - method `unknown` not found for this
|
| - method `unknown` not found for this
|
||||||
...
|
...
|
||||||
42 | html! { <ChildComponent unknown="unknown" /> };
|
67 | html! { <Child unknown="unknown" /> };
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
error[E0599]: no method named `build` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
--> $DIR/html-component-fail.rs:43:5
|
--> $DIR/html-component-fail.rs:68:5
|
||||||
|
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
5 | #[derive(Properties, PartialEq)]
|
||||||
| - method `build` not found for this
|
| - method `build` not found for this
|
||||||
...
|
...
|
||||||
43 | html! { <ChildComponent string= /> };
|
68 | html! { <Child string= /> };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/html-component-fail.rs:44:42
|
--> $DIR/html-component-fail.rs:69:33
|
||||||
|
|
|
|
||||||
44 | html! { <ChildComponent int=1 string={} /> };
|
69 | html! { <Child int=1 string={} /> };
|
||||||
| ^^ expected struct `std::string::String`, found ()
|
| ^^ expected struct `std::string::String`, found ()
|
||||||
|
|
|
|
||||||
= note: expected type `std::string::String`
|
= note: expected type `std::string::String`
|
||||||
found type `()`
|
found type `()`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/html-component-fail.rs:45:42
|
--> $DIR/html-component-fail.rs:70:33
|
||||||
|
|
|
|
||||||
45 | html! { <ChildComponent int=1 string=3 /> };
|
70 | html! { <Child int=1 string=3 /> };
|
||||||
| ^
|
| ^
|
||||||
| |
|
| |
|
||||||
| expected struct `std::string::String`, found integer
|
| expected struct `std::string::String`, found integer
|
||||||
| help: try using a conversion method: `3.to_string()`
|
| help: try using a conversion method: `3.to_string()`
|
||||||
|
|
|
|
||||||
= note: expected type `std::string::String`
|
= note: expected type `std::string::String`
|
||||||
found type `{integer}`
|
found type `{integer}`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/html-component-fail.rs:46:42
|
--> $DIR/html-component-fail.rs:71:33
|
||||||
|
|
|
|
||||||
46 | html! { <ChildComponent int=1 string={3} /> };
|
71 | html! { <Child int=1 string={3} /> };
|
||||||
| ^^^
|
| ^^^
|
||||||
| |
|
| |
|
||||||
| expected struct `std::string::String`, found integer
|
| expected struct `std::string::String`, found integer
|
||||||
| help: try using a conversion method: `{3}.to_string()`
|
| help: try using a conversion method: `{3}.to_string()`
|
||||||
|
|
|
|
||||||
= note: expected type `std::string::String`
|
= note: expected type `std::string::String`
|
||||||
found type `{integer}`
|
found type `{integer}`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/html-component-fail.rs:47:33
|
--> $DIR/html-component-fail.rs:72:24
|
||||||
|
|
|
|
||||||
47 | html! { <ChildComponent int=0u32 /> };
|
72 | html! { <Child int=0u32 /> };
|
||||||
| ^^^^ expected i32, found u32
|
| ^^^^ expected i32, found u32
|
||||||
|
|
||||||
error[E0599]: no method named `string` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
error[E0599]: no method named `string` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
--> $DIR/html-component-fail.rs:48:29
|
--> $DIR/html-component-fail.rs:73:20
|
||||||
|
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
5 | #[derive(Properties, PartialEq)]
|
||||||
| - method `string` not found for this
|
| - method `string` not found for this
|
||||||
...
|
...
|
||||||
48 | html! { <ChildComponent string="abc" /> };
|
73 | html! { <Child string="abc" /> };
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error[E0599]: no method named `children` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
error[E0599]: no method named `children` found for type `ChildPropertiesBuilder<ChildPropertiesBuilderStep_missing_required_prop_int>` in the current scope
|
||||||
--> $DIR/html-component-fail.rs:52:5
|
--> $DIR/html-component-fail.rs:77:5
|
||||||
|
|
|
|
||||||
5 | #[derive(Properties, PartialEq)]
|
5 | #[derive(Properties, PartialEq)]
|
||||||
| - method `children` not found for this
|
| - method `children` not found for this
|
||||||
...
|
...
|
||||||
52 | html! { <ChildComponent>{ "Not allowed" }</ChildComponent> };
|
77 | html! { <Child>{ "Not allowed" }</Child> };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
Some errors occurred: E0308, E0425, E0599, E0609.
|
error[E0277]: the trait bound `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>: std::convert::From<yew::virtual_dom::vnode::VNode<_>>` is not satisfied
|
||||||
For more information about an error, try `rustc --explain E0308`.
|
--> $DIR/html-component-fail.rs:78:5
|
||||||
|
|
|
||||||
|
78 | html! { <ChildContainer>{ "Not allowed" }</ChildContainer> };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<yew::virtual_dom::vnode::VNode<_>>` is not implemented for `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>`
|
||||||
|
|
|
||||||
|
= note: required because of the requirements on the impl of `std::convert::Into<yew::virtual_dom::vcomp::VChild<Child, ChildContainer>>` for `yew::virtual_dom::vnode::VNode<_>`
|
||||||
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>: std::convert::From<yew::virtual_dom::vnode::VNode<_>>` is not satisfied
|
||||||
|
--> $DIR/html-component-fail.rs:79:5
|
||||||
|
|
|
||||||
|
79 | html! { <ChildContainer><></></ChildContainer> };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<yew::virtual_dom::vnode::VNode<_>>` is not implemented for `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>`
|
||||||
|
|
|
||||||
|
= note: required because of the requirements on the impl of `std::convert::Into<yew::virtual_dom::vcomp::VChild<Child, ChildContainer>>` for `yew::virtual_dom::vnode::VNode<_>`
|
||||||
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>: std::convert::From<yew::virtual_dom::vcomp::VChild<ChildContainer, _>>` is not satisfied
|
||||||
|
--> $DIR/html-component-fail.rs:80:5
|
||||||
|
|
|
||||||
|
80 | html! { <ChildContainer><ChildContainer /></ChildContainer> };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<yew::virtual_dom::vcomp::VChild<ChildContainer, _>>` is not implemented for `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>`
|
||||||
|
|
|
||||||
|
= note: required because of the requirements on the impl of `std::convert::Into<yew::virtual_dom::vcomp::VChild<Child, ChildContainer>>` for `yew::virtual_dom::vcomp::VChild<ChildContainer, _>`
|
||||||
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>: std::convert::From<yew::virtual_dom::vcomp::VChild<ChildContainer, _>>` is not satisfied
|
||||||
|
--> $DIR/html-component-fail.rs:81:5
|
||||||
|
|
|
||||||
|
81 | html! { <ChildContainer><ChildContainer /></ChildContainer> };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<yew::virtual_dom::vcomp::VChild<ChildContainer, _>>` is not implemented for `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>`
|
||||||
|
|
|
||||||
|
= note: required because of the requirements on the impl of `std::convert::Into<yew::virtual_dom::vcomp::VChild<Child, ChildContainer>>` for `yew::virtual_dom::vcomp::VChild<ChildContainer, _>`
|
||||||
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>: std::convert::From<yew::virtual_dom::vnode::VNode<_>>` is not satisfied
|
||||||
|
--> $DIR/html-component-fail.rs:82:5
|
||||||
|
|
|
||||||
|
82 | html! { <ChildContainer><Child int=1 /><other /></ChildContainer> };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<yew::virtual_dom::vnode::VNode<_>>` is not implemented for `yew::virtual_dom::vcomp::VChild<Child, ChildContainer>`
|
||||||
|
|
|
||||||
|
= note: required because of the requirements on the impl of `std::convert::Into<yew::virtual_dom::vcomp::VChild<Child, ChildContainer>>` for `yew::virtual_dom::vnode::VNode<_>`
|
||||||
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
|
Some errors occurred: E0277, E0308, E0425, E0599, E0609.
|
||||||
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|||||||
@ -14,13 +14,13 @@ pub struct ChildProperties {
|
|||||||
pub optional_callback: Option<Callback<()>>,
|
pub optional_callback: Option<Callback<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ChildComponent;
|
pub struct Child;
|
||||||
impl Component for ChildComponent {
|
impl Component for Child {
|
||||||
type Message = ();
|
type Message = ();
|
||||||
type Properties = ChildProperties;
|
type Properties = ChildProperties;
|
||||||
|
|
||||||
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
|
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
|
||||||
ChildComponent
|
Child
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
||||||
@ -28,26 +28,26 @@ impl Component for ChildComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Renderable<ChildComponent> for ChildComponent {
|
impl Renderable<Child> for Child {
|
||||||
fn view(&self) -> Html<Self> {
|
fn view(&self) -> Html<Self> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Properties, Default)]
|
#[derive(Properties, Default)]
|
||||||
pub struct ParentProperties {
|
pub struct ContainerProperties {
|
||||||
#[props(required)]
|
#[props(required)]
|
||||||
pub int: i32,
|
pub int: i32,
|
||||||
pub children: Children<ChildComponent>,
|
pub children: Children<Container>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ParentComponent;
|
pub struct Container;
|
||||||
impl Component for ParentComponent {
|
impl Component for Container {
|
||||||
type Message = ();
|
type Message = ();
|
||||||
type Properties = ParentProperties;
|
type Properties = ContainerProperties;
|
||||||
|
|
||||||
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
|
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
|
||||||
ParentComponent
|
Container
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
||||||
@ -55,89 +55,116 @@ impl Component for ParentComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Renderable<Self> for ParentComponent {
|
impl Renderable<Self> for Container {
|
||||||
|
fn view(&self) -> Html<Self> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Properties, Default)]
|
||||||
|
pub struct ChildContainerProperties {
|
||||||
|
#[props(required)]
|
||||||
|
pub int: i32,
|
||||||
|
pub children: ChildrenWithProps<Child, ChildContainer>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ChildContainer;
|
||||||
|
impl Component for ChildContainer {
|
||||||
|
type Message = ();
|
||||||
|
type Properties = ChildContainerProperties;
|
||||||
|
|
||||||
|
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
|
||||||
|
ChildContainer
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Renderable<Self> for ChildContainer {
|
||||||
fn view(&self) -> Html<Self> {
|
fn view(&self) -> Html<Self> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod scoped {
|
mod scoped {
|
||||||
pub use super::ChildComponent;
|
pub use super::Child;
|
||||||
pub use super::ParentComponent;
|
pub use super::Container;
|
||||||
}
|
}
|
||||||
|
|
||||||
pass_helper! {
|
pass_helper! {
|
||||||
html! { <ChildComponent int=1 /> };
|
html! { <Child int=1 /> };
|
||||||
|
|
||||||
// backwards compat
|
// backwards compat
|
||||||
html! { <ChildComponent: int=1 /> };
|
html! { <Child: int=1 /> };
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<ChildComponent int=1 />
|
<Child int=1 />
|
||||||
<scoped::ChildComponent int=1 />
|
<scoped::Child int=1 />
|
||||||
|
|
||||||
// backwards compat
|
// backwards compat
|
||||||
<ChildComponent: int=1 />
|
<Child: int=1 />
|
||||||
<scoped::ChildComponent: int=1 />
|
<scoped::Child: int=1 />
|
||||||
</>
|
</>
|
||||||
};
|
};
|
||||||
|
|
||||||
let props = <ChildComponent as Component>::Properties::default();
|
let props = <Child as Component>::Properties::default();
|
||||||
let props2 = <ChildComponent as Component>::Properties::default();
|
let props2 = <Child as Component>::Properties::default();
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<ChildComponent with props />
|
<Child with props />
|
||||||
|
|
||||||
// backwards compat
|
// backwards compat
|
||||||
<ChildComponent: with props2, />
|
<Child: with props2, />
|
||||||
</>
|
</>
|
||||||
};
|
};
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<ChildComponent int=1 string="child" />
|
<Child int=1 string="child" />
|
||||||
<ChildComponent int=1 />
|
<Child int=1 />
|
||||||
<ChildComponent int={1+1} />
|
<Child int={1+1} />
|
||||||
<ChildComponent int=1 vec={vec![1]} />
|
<Child int=1 vec={vec![1]} />
|
||||||
<ChildComponent string={String::from("child")} int=1 />
|
<Child string={String::from("child")} int=1 />
|
||||||
|
|
||||||
// backwards compat
|
// backwards compat
|
||||||
<ChildComponent: string="child", int=3, />
|
<Child: string="child", int=3, />
|
||||||
</>
|
</>
|
||||||
};
|
};
|
||||||
|
|
||||||
let name_expr = "child";
|
let name_expr = "child";
|
||||||
html! {
|
html! {
|
||||||
<ChildComponent int=1 string=name_expr />
|
<Child int=1 string=name_expr />
|
||||||
};
|
};
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<ChildComponent int=1 />
|
<Child int=1 />
|
||||||
<ChildComponent int=1 optional_callback=|_| () />
|
<Child int=1 optional_callback=|_| () />
|
||||||
</>
|
</>
|
||||||
};
|
};
|
||||||
|
|
||||||
let props = <ParentComponent as Component>::Properties::default();
|
let props = <Container as Component>::Properties::default();
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<ParentComponent int=1 />
|
<Container int=1 />
|
||||||
<ParentComponent int=1></ParentComponent>
|
<Container int=1></Container>
|
||||||
|
|
||||||
<ParentComponent with props>
|
<Container with props>
|
||||||
<></>
|
<></>
|
||||||
</ParentComponent>
|
</Container>
|
||||||
|
|
||||||
<ParentComponent int=1>
|
<Container int=1>
|
||||||
<ChildComponent int=2 />
|
<Child int=2 />
|
||||||
</ParentComponent>
|
</Container>
|
||||||
|
|
||||||
<scoped::ParentComponent int=1>
|
<scoped::Container int=1>
|
||||||
<scoped::ParentComponent int=2/>
|
<scoped::Container int=2/>
|
||||||
</scoped::ParentComponent>
|
</scoped::Container>
|
||||||
|
|
||||||
<ParentComponent int=1 children=ChildrenRenderer::new(
|
<Container int=1 children=ChildrenRenderer::new(
|
||||||
::std::boxed::Box::new(move || {
|
::std::boxed::Box::new(move || {
|
||||||
|| -> ::std::vec::Vec<_> {
|
|| -> ::std::vec::Vec<_> {
|
||||||
vec![html!{ "String" }]
|
vec![html!{ "String" }]
|
||||||
@ -146,6 +173,15 @@ pass_helper! {
|
|||||||
) />
|
) />
|
||||||
</>
|
</>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
html! {
|
||||||
|
<>
|
||||||
|
<ChildContainer int=1 />
|
||||||
|
<ChildContainer int=1></ChildContainer>
|
||||||
|
<ChildContainer int=1><Child int = 2 /></ChildContainer>
|
||||||
|
<ChildContainer int=1><Child int = 2 /><Child int = 2 /></ChildContainer>
|
||||||
|
</>
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user