iced-template: factor out Element, explicit Error
the type alias Element is quite useful for defining subfunctions for view and it also helps to not pull unnecessary things into scope
This commit is contained in:
parent
0095d05e80
commit
27f6371c2c
1 changed files with 5 additions and 3 deletions
|
|
@ -1,4 +1,6 @@
|
|||
use iced::{Color, Element, Renderer, Task, Theme, application, theme, widget};
|
||||
use iced::{Color, Task, application, theme, widget};
|
||||
|
||||
type Element<'a> = iced::Element<'a, Message, iced::Theme, iced::Renderer>;
|
||||
|
||||
enum Message {}
|
||||
|
||||
|
|
@ -11,12 +13,12 @@ impl State {
|
|||
fn update(&mut self, message: Message) -> Task<Message> {
|
||||
Task::none()
|
||||
}
|
||||
fn view(&self) -> Element<'_, Message, Theme, Renderer> {
|
||||
fn view(&self) -> Element<'_> {
|
||||
widget::text("hiiiiiii").into()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run() -> Result<(), impl std::error::Error> {
|
||||
pub fn run() -> Result<(), iced::Error> {
|
||||
application(State::new, State::update, State::view)
|
||||
.theme(theme::Theme::custom(
|
||||
"high-contrast-dark",
|
||||
|
|
|
|||
Loading…
Reference in a new issue