-
Notifications
You must be signed in to change notification settings - Fork 920
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
Changed EventLoop to give a result instead of panicking #2165
Conversation
You can test if you are on the main thread yourself and call the appropriate |
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.
Seems sensible to me — I already have to handle errors from other things constructed alongside the EventLoop
.
src/event_loop.rs
Outdated
@@ -136,7 +136,7 @@ impl EventLoop<()> { | |||
/// ## Platform-specific | |||
/// | |||
/// - **iOS:** Can only be called on the main thread. | |||
pub fn new() -> EventLoop<()> { | |||
pub fn new() -> Result<EventLoop<()>, String> { |
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.
Check doc on this method
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.
I am guessing you mean change the docs for this one, and the example
To me this just feels like trying to get around the issue of panicking instead of just making it return a result instead of panicking. Which returning a result feels cleaner to me. |
Let's merge #2137 first, that has a fair implication on this |
Yeah, I think it makes sense to do this change (but please rebase first). However, since it is probably quite rare that people will be needing this, maybe we should consider |
… rust-windowing-master
I have fixed the conflicts in the different branches, and it works fine from testing custom_events and control_flow |
Could you put those changes in this branch (by using either |
I have done this now |
For some reason I was on the wrong branch, now I am on the right branch |
I have made those changes |
@madsmtm Any changed I need to do now or is it good? |
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.
Sorry, I don't have much time lately.
But CI doesn't pass, so that's at least missing.
Cl? |
Continuous Integration. In our case, we make sure everything is formatted correctly and compiles on all platforms (there's also a test suite, but I believe that one is relatively small). You can see the things that failed at the bottom of a PR's page. We need all of these checks to pass in order to merge. |
Why are they failing? |
You can click on the "details" button to find out |
it looks like cthulu is speaking in my ears |
Some of winit's public structs (like |
Why isn't it telling me in my IDE there are these type errors |
Because your IDE only runs checks for a single target triple (presumably |
I do not feel like making the required changes as of right now to finish this pull request so I will now close this. (I don't know if other people can reopen pr's but if someone else wants to finish this they can) |
CHANGELOG.md
if knowledge of this change could be valuable to usersI wanted to because if creating a EventLoop fails because not on main thread then you could match that and do
EventLoop::new_any_thread()
on linux you can at least.