-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Is your issue REALLY a bug?
- My issue is indeed a bug!
- I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.
Is there an existing issue for this?
- I have searched the existing issues.
Is this issue related to iced?
- My hardware is compatible and my graphics drivers are up-to-date.
What happened?
This seems to be a regression in features.
With the new BootFn abstraction, you are expected to provide a boot function as the first argument to iced::application:
iced::application(|| /* build application */, .., ..)This replaces the old mechanism of run_with.
However, since the boot fn is only implemented for Fn, it can no longer be used for owned state passed into the application:
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
--> src/lib.rs:178:9
|
177 | iced::application(
| ----------------- required by a bound introduced by this call
178 | || Application::new(service),
| ^^--------------------------
| | |
| | closure is `FnOnce` because it moves the variable `service` out of its environment
| this closure implements `FnOnce`, not `Fn`
| the requirement to implement `Fn` derives from here
|
= note: required for `{closure@src/lib.rs:178:9: 178:11}` to implement `BootFn<application::Application, application::Message>`This is a bit of an issue when the state being passed into the application is difficult to clone or expensive to set up which is the case for the application I'm migrating.
What is the expected behavior?
That BootFn is implemented for FnOnce or something else allowing a similar mechanism as run_with to be used.
Version
master
Operating System
Linux
Do you have any log output?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working