0.14.dev bootfn config

To get around the inability to work with a subscription with an argument in version 0.13, I tried version 0.14-dev.

But in 0.14.0 dev application have bootfn, that can’t hold || self as arg, so there no way to pass config to boot fn.

So to make simple init of state, seems is should make something like new(conf0, conf1, …), than copy it’s result into global mutable, and than make bootfn, that just access the global mutable?

Or there is any other way to make application that do not want bootfn and can just take state?

If you’re sure you can’t just create any config in your bootfn, you can clone/copy data to adhere to FnOnce requirements. So move || App::new(config.clone()) should work, for example.

I can clone if only it’s can be cloned. There is not my case and it’s will not work.

What i should do if config have fields, that can’t be cloned?

create the state from inside iced?

That, or use an Arc if you don’t need ownership of it.

It’s not possible - iced should take receiver<..> and some other stuff from outside.

That, or use an Arc if you don’t need ownership of it. - i need to take receiver and some other stuff, that shold not be inside arc and e.t.c

i just need to make:

  let app = iced::application(|| self, Self::update, Self::view)
        .theme(Theme::Dark)
        .subscription(|a| a.subscription());

    //app.run_with(move || (self, iced::Task::none())) - work well in 0.13.0
    app.run();

I don’t understand at all why they added bootfn and how, theoretically, i can benefit from this in any scenario.

Why not just state?

For time travel debugging to work, your original base state beeds to be recreatable. So it was either a Clone bound on your state or this.

Have a look at this. You can simply implement the boot function and provide whatever you need there