Skip to content
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

Use separate types for each platform #60

Closed
chrisduerr opened this issue Dec 21, 2020 · 3 comments · Fixed by #67 or #70
Closed

Use separate types for each platform #60

chrisduerr opened this issue Dec 21, 2020 · 3 comments · Fixed by #67 or #70

Comments

@chrisduerr
Copy link

I find the current API a bit strange, since it basically offers an enum that just has a single member on most platforms.

Is there any reason why the RawWindowHandle isn't just a platform-specific type that is decided at compile-time? It's not like people are going to be matching against the platform's implementation at runtime, especially since this is impossible because the enum has only the members available for the current platform.

@grovesNL
Copy link
Contributor

The variants don't all match 1:1 with a platform, so the variant isn't known at compile-time. For example, Xlib, Xcb, and Wayland are all available on linux

@chrisduerr
Copy link
Author

Yeah, which is not a problem. You can still provide an enum for platforms that actually make a decision at runtime.

But adding a runtime check for something that can be uniquely identified at compile time just leads to unergonomic code.

@Lokathor
Copy link
Contributor

I'm inclined to go in the direction of #63. We keep the enum, and just remove all the cfg stuff.

@Lokathor Lokathor mentioned this issue Jan 25, 2021
2 tasks
@Friz64 Friz64 mentioned this issue Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants