Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReduce the number of crates library users need to care about #283
Comments
|
I really like the front-end / back-end crates, because then it’s easy to know as a user explicitly which platforms you are supporting. I can also imagine the associated docs being very obvious and easy to follow: “I want canvas, and I want to support OpenGL and Metal, so I install pathfinder_X” Does reexporting add any overhead? |
|
It shouldn't add any overhead, no. |
|
I like the reexport everything behind feature flags. |
|
I would rather people depend on whatever crate they want to use than use an umbrella crate with one feature per backend. |
|
Having a big umbrella crate means that your Cargo.lock is full of things you don't actually use, which is confusing when reading the lock file (yes, sometimes you do need to do that), or when using tools such as |
|
Also, although I like the appeal for the So directly depending on what you want IME, is better. [nb: I speak on behalf of Gentoo, so my opinion may seem selective, but I also converse with debian folk and people who work on this sort of thing in a few vendors, so its not entirely unique an opinion I'm channeling here, just some of it may be more mine than theirs] |
Export types need to use the canvas API from other pathfinder crates. From pathfinder-color all types and convinience functions are exported. From pathfinder-geometry only the 2D vector and rect types with their convinience functions are exported. Items from pathfinder-renderer are not re-exported as they also belong to the back-end. Pattern, while used in the canvas API, is not re-exported as it is not needed for basic usage and depends on a lot of other types. See servo#283
|
I think we're going to hold off on this for now, per feedback. Closing for now, but may reopen in the future if this decision changes. |
Right now we have a lot of crates, and this is causing friction for potential library users. One option would be to have a super-crate that reexports everything important. But I worry this crate will grow without limit. We already have Pathfinder native API, canvas, SVG, PDF, SWF, and Lottie frontends and it's unlikely a user will care about all of them. Likewise with GPU API backends: we already have OpenGL, WebGL, and Metal backends and will possibly get Vulkan, DX11, DX12, and gfx-rs backends in the future; it's unlikely a user wants to run on all of these platforms.
I think perhaps we could have the "front-end" crates—
pathfinder_canvasandpathfinder_svg—reexport the functionality necessary to use them. Then you'd only need to import two crates in most cases: the front-end (pathfinder_canvas/pathfinder_svg) and a GPU backend (pathfinder_gl, etc.) Another option would be to have a front-endpathfinder_vgcrate that reexports all the subcrates behind feature flags. (Unfortunately it can't be named justpathfinderbecause that name is already in use on crates.io.)Other suggestions and ideas are very welcome.