-
Notifications
You must be signed in to change notification settings - Fork 921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
ApplicationHandler
for&mut
references. This means that we can now changerun_app_x
methods 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
app
to an&mut app
(or&mut dyn ApplicationHandler
) if that's easier for them to pass around.changelog
module if knowledge of this change could be valuable to users