On wasm, provide intradoc-link for spawn() function in EventLoop docs#3178
On wasm, provide intradoc-link for spawn() function in EventLoop docs#3178
spawn() function in EventLoop docs#3178Conversation
This re-works the portable `run()` API that consumes the `EventLoop` and runs the loop on the calling thread until the app exits. This can be supported across _all_ platforms and compared to the previous `run() -> !` API is now able to return a `Result` status on all platforms except iOS and Web. Fixes: #2709 By moving away from `run() -> !` we stop calling `std::process::exit()` internally as a means to kill the process without returning which means it's possible to return an exit status and applications can return from their `main()` function normally. This also fixes Android support where an Activity runs in a thread but we can't assume to have full ownership of the process (other services could be running in separate threads). Additionally all examples have generally been updated so that `main()` returns a `Result` from `run()` Fixes: #2709
| )] | ||
| /// | ||
| /// [`set_control_flow()`]: EventLoopWindowTarget::set_control_flow() | ||
| /// [`run()`]: Self::run() |
There was a problem hiding this comment.
Not super happy with this, because it'll fail to link on not(all(wasm_platform, target_feature = "exception-handling")) (which is strange, because features must be additive and should not remove functionality).
There was a problem hiding this comment.
target_feature = "exception-handling" isn't stable, which is probably why it didn't work for you.
There was a problem hiding this comment.
@daxpedda reading this again, I missed target_ and assumed it was just feature = (from the [features] list in Cargo.toml).
I think the feature must have been _en_abled (running nightly rustdoc for --cfg docsrs => doc_cfg), as it's the only way to cause not(all(true, true)) = not(true) = false and turn off fn run()?
There was a problem hiding this comment.
That is weird, target_feature = "exception-handling" should not automatically have been enabled by running nightly rustdoc.
| //! [`DeviceEvent`]: event::DeviceEvent | ||
| //! [`UserEvent`]: event::Event::UserEvent | ||
| //! [`LoopExiting`]: event::Event::LoopExiting | ||
| //! [`Event::LoopExiting`]: event::Event::LoopExiting |
There was a problem hiding this comment.
I don't want this PR to turn into a "let's fix all winit intradoc links", but a few more changes are still needed to make this consistent.
No clue what the point is with manual relative .html links that may not resolve when certain features are not turned on... Pointing the user to a 404 page :(
There was a problem hiding this comment.
This is probably a problem for another time, but these methods are deprecated anyway.
25788b7 to
d6eedc7
Compare
d6eedc7 to
b56169b
Compare
3627974 to
514564b
Compare
…docs And on any other platform, emit a footnote explaining that this function is only available on wasm.
514564b to
2b33b97
Compare
|
Just rebased so we can merge. |
For 0d366ff#r130681051
And on any other platform, emit a footnote explaining that this function is only available on wasm.
EDIT: Apologies, it looks like
gh pr createpushed this through the main repo instead of my fork. Hence there's nomarijn/prefix on the branchname.