glutin icon indicating copy to clipboard operation
glutin copied to clipboard

Reexport `Display`, `Config`, etc in the `api::<platform>` modules

Open i509VCB opened this issue 3 years ago • 5 comments

Right now I need to write the following to use EGL:

use glutin::api::egl;

let display = egl::display::Display::from_raw(display_handle);

i509VCB avatar Oct 06 '22 03:10 i509VCB

I see your issue, but nothing stops from exporting the Display directly?

The thing is that we don't have reexports for top-level structs as well, and I don't see why we should? Right the only change of toplevel exports and the ones from api is api::backend part.

So you have.

use glutin::display::Display
use glutin::api::egl::display::Display

It's not that much longer?

You may ask how to mix api and top-level exports, but the thing is that you don't. You can access api from top-level without a single use, and if you use api directly it means that you`ve explicitly opted out from top-level api.

kchibisov avatar Oct 06 '22 03:10 kchibisov

Right now I need to write the following to use EGL:

And? Your issue fails to mention what the problem is here.

Do you find it too long? Or are you disliking the repetitive naming of mod and item inside the mod being the same? If so, please mention this explicitly.

MarijnS95 avatar Oct 06 '22 08:10 MarijnS95

I guess my desire here is the have the commonly used types (for example Display, Context, Surface, Config) all reexported in the root module of glutin. For the api dependent types, reexported in the respective api::<platform>.

So ideally you could reference Display with the following

let display = glutin::Display::from_raw(...);

For APIs, something like this:

let display = glutin::api::egl::Display::from_raw(...);

Regarding what Marijin said, a bit of both. Needing to specify display::Display feels redundant and needlessly lengthens the import paths.

i509VCB avatar Oct 07 '22 09:10 i509VCB

So far I've seen Marjin, but Marijin is new :grimacing:

Thanks for clarifying, though!

MarijnS95 avatar Oct 07 '22 09:10 MarijnS95

Sure if we do that for both top-levels and apis it should be fine. Though, the issue is that we have a lot of builders around to create values...

Not sure whether we should reexport them as well? It's like you'd have to bring use glutin::context::ContextBuidler anyway to create Context...

kchibisov avatar Oct 07 '22 09:10 kchibisov