I wanted to try out iced for my biotech project, however, when going through the docs and reimplementing example code I get following compilation error
expected `iced_core::element::Element<Message, iced_core::theme::Theme, iced_renderer::Renderer>`, but found `iced_widget::button::Button<Message, _, _>`
basically the column! macro does not like the arguments.
Here's my full code
use iced::widget::{button, text, column, Column};
pub struct Counter {
pub value: i64,
}
#[derive(Debug, Clone, Copy)]
pub enum Message {
Increment,
Decrement,
}
impl Counter {
fn view(&self) -> Column<Message> {
// The buttons
let increment = button("+").on_press(Message::Increment);
let decrement = button("-").on_press(Message::Decrement);
// The number
let counter = text(self.value);
// The layout
let interface = column![increment, counter, decrement];
interface
}
pub fn update(&mut self, message: Message) {
match message {
Message::Increment => {
println!("Incrementing counter");
self.value += 1
},
Message::Decrement => self.value -= 1,
}
}
}
I wanted to try out iced for my biotech project, however, when going through the docs and reimplementing example code I get following compilation error
basically the
column!macro does not like the arguments.Here's my full code