-
I wrapped #[derive(Debug, Clone)]
enum Message {
Start,
EventOccurred(Event),
} It's ok and nice work. But, I can't add more wrapped variant in this #[derive(Debug, Clone)]
enum Message {
Start,
EventOccurred(Event),
OpenFile(String),
} It doesn't work in container(e).height(Length::Fill)
.width(Length::Fill)
.center_x()
.center_y()
.into() The compiler give the trait bound `iced_native::Element<'_, Message, iced_graphics::renderer::Renderer<iced_wgpu::backend::Backend, Theme>>: From<iced_native::widget::Container<'_, fn(String) -> Message {Message::OpenFile}, _>>` is not satisfied
the following other types implement trait `From<T>`:
<iced_native::Element<'a, Message, Renderer> as From<&'a str>>
<iced_native::Element<'a, Message, Renderer> as From<Column<'a, Message, Renderer>>>
<iced_native::Element<'a, Message, Renderer> as From<Image<Handle>>>
<iced_native::Element<'a, Message, Renderer> as From<Row<'a, Message, Renderer>>>
<iced_native::Element<'a, Message, Renderer> as From<Tooltip<'a, Message, Renderer>>>
<iced_native::Element<'a, Message, Renderer> as From<VerticalSlider<'a, T, Message, Renderer>>>
<iced_native::Element<'a, Message, Renderer> as From<Viewer<Handle>>>
<iced_native::Element<'a, Message, Renderer> as From<iced::widget::ProgressBar<Renderer>>>
and 15 others
required for `iced_native::widget::Container<'_, fn(String) -> Message {Message::OpenFile}, _>` to implement `Into<iced_native::Element<'_, Message, iced_graphics::renderer::Renderer<iced_wgpu::backend::Backend, Theme>>>` How can I deal with it? |
Beta Was this translation helpful? Give feedback.
Answered by
hecrj
Mar 16, 2023
Replies: 1 comment 1 reply
-
Rust is telling you your widget What is |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dryBranch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rust is telling you your widget
Message
is a function, so you are most likely missing an argument somewhere.What is
e
? How are you using the newOpenFile
variant?