Remove load method from application and daemon

If you need to run a `Task` during boot, use
`run_with` instead!
This commit is contained in:
Héctor Ramón Jiménez 2024-07-09 00:28:40 +02:00
parent 3d99da805d
commit e86920be5b
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
10 changed files with 70 additions and 197 deletions

View file

@ -18,16 +18,14 @@ pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
iced::application(Todos::title, Todos::update, Todos::view)
.load(Todos::load)
.subscription(Todos::subscription)
.font(include_bytes!("../fonts/icons.ttf").as_slice())
.window_size((500.0, 800.0))
.run()
.run_with(Todos::new)
}
#[derive(Default, Debug)]
#[derive(Debug)]
enum Todos {
#[default]
Loading,
Loaded(State),
}
@ -54,8 +52,11 @@ enum Message {
}
impl Todos {
fn load() -> Command<Message> {
Command::perform(SavedState::load(), Message::Loaded)
fn new() -> (Self, Command<Message>) {
(
Self::Loading,
Command::perform(SavedState::load(), Message::Loaded),
)
}
fn title(&self) -> String {