-
Notifications
You must be signed in to change notification settings - Fork 910
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
Display all platform-specific documentation on docs.rs #3076
Conversation
CHANGELOG.md
Outdated
@@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre | |||
|
|||
# Unreleased | |||
|
|||
- **Breaking:** No longer export `platform::x11::XNotSupported`. |
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.
@notgull I couldn't see a reason why this was exported, so I removed it, but maybe you can shed some light on it?
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 feel like this could become annoying to maintain, but generally a really good change for users!
I don't quite get the motivation behind this, it could be really confusing to show it all the time, given that you should pay attention to metadata, like where the function actually works. I guess the only argument pro this is that it's easier to find docs for other targets, but I'd expect when you work with cross platform code you open docs for the target you want, since while winit can do such a thing with |
MotivationYou get to see immediately what functionality is available, without having to select on docs.rs the platform you're currently working on. This would probably have gone a long way towards the user here finding a solution for their problem quicker. |
I mean, if they do cross dev, they should open docs with the correct target in the end. I'm just afraid to maintain that and work with such docs because I'm sort of really used to how it works based on target and I use the docs based on target. The docs.rs even has a field to show docs per target, which sort of implies that they work for this target, but if we always show all the docs you can't really rely on your target picking. Like for example I don't even want to see docs for macOS when writing code for linux, like why would I even have to read them and in my search, if they are just irrelevant for me? |
Hmm, I definitely get your points! I think the best answer to that would be that the
Myself, I've often wished (If you're developing locally, you could always just do |
@madsmtm you can just pass Also, have you looked into how rust does the docs in stdlib? They have |
I think "I'm not used to seeing the other platforms in the documentation" should be trumped by "increased discovery of platform-specific APIs in a cross-platform library". About the maintenance issue: @madsmtm has done good effort in putting this together and it seems quite straightforward to me. The way Winit is structured lends itself incredibly well to this system, because we have separated the files so neatly. I'm still strongly in favor of this change. But I acknowledge this comes with a maintenance burden, which I believe considering the benefits and the current structure of Winit is negligible. |
@madsmtm the issue I have after this change, is that it looks like this: So I have no information whatsoever to determine what is available for me and what is not. I was just using |
Yeah, you need nightly for that and |
I agree, that is a problem. @madsmtm shouldn't we be able to only expose all other platforms when we also require |
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
Looking forward to seeing this, especially in light of #3178, though hope it doesn't conflict too badly 😅 E.g. there is some docs pointing from |
3eed152
to
85d3ef0
Compare
Apologies for the delay, I've done so now. |
85d3ef0
to
77780f7
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.
Thank you for doing this, this is so cool!
77780f7
to
f43bfde
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.
LGTM!
f43bfde
to
97c74a2
Compare
97c74a2
to
3a23182
Compare
This required a few ugly hacks, such as making some #[doc(hidden)] empty structs on platforms where we expose some external dependency - but I tend to think that's a somewhat good thing, since it makes it more explicit that we have a public dependency here.
Co-authored-by: daxpedda <daxpedda@gmail.com>
3a23182
to
cab4211
Compare
This required a bit of refactoring regarding platform privacy, but all of it for the better.
CHANGELOG.md
if knowledge of this change could be valuable to users