Change run_app(app: &mut A) to run_app(app: A)#3721
Conversation
|
The API is intentionally that way because we want to |
|
Hmm, I think you can still convert it internally to E.g. (playground): trait ApplicationHandler {}
fn run_app<A: ApplicationHandler>(mut app: A) {
run_app_inner(&mut app)
}
fn run_app_inner(app: &mut dyn ApplicationHandler) {
// ...
}But perhaps I'm missing something? |
|
You can not really have generic on the trait, which you want to make What's the end goal with this? |
Hmm, from what I understood, it's the
It's twofold:
(Not directly proposing either of those here, in particular the story around number 1 and Android isn't fleshed out, but that's at least how it ought to work on iOS (i.e. the current "drop window on Suspended" is wrong there)). |
|
Resolution from meeting: We want to do this, though the path is a bit more unclear for pump events. I'll try to flesh out the PR some more. Things noted in our meeting document:
|
594fc5b to
1f7ae9b
Compare
|
Responding to @kchibisov's concerns:
Whether to use
I changed these to have the same interface as For I agree that usually the user would probably want to pass |
b0c8b23 to
dfa3080
Compare
kchibisov
left a comment
There was a problem hiding this comment.
The main issue with it is that later on you can not really put it on a trait that way, though, maybe it'll be possible somehow, but for now it's fine.
dfa3080 to
ef54e81
Compare
ef54e81 to
e69ddff
Compare
Since #3709, we do a blanket impl of
ApplicationHandlerfor&mutreferences. This means that we can now changerun_app_xmethods to consume the application instead of taking a reference to it.This allows the user more control over how they pass their application state to Winit.
Internally, each backend is free to convert the
appto an&mut app(or&mut dyn ApplicationHandler) if that's easier for them to pass around.changelogmodule if knowledge of this change could be valuable to users