-
Notifications
You must be signed in to change notification settings - Fork 79
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
Refactor crate structure #4
Comments
I just saw there was an issue about it (thx!). I think |
Let's discuss this here :) So I don't really have a personal preference here because I'm quite new to Rust workspaces. I tried to follow the best/most common practice here:
Some other keep "sub-crates" in a The rule is: "Put subcrates at the top-level and name the directories like the name of the crate." |
Yep, makes sense to me. I would just add that i think most creates would not need to be named maplibre-foo -- if it's a good piece of functionality, it's probably not related to maplibre (e.g. tilejson parser). And if it is usable only by maplibre, we probably won't publish it by itself. I'm sure there are exceptions to this, but we can always just use the prefixed name in the crates.toml, while keeping the dir structure simple |
true, but I think it makes sense to use a generic name like So the creates have to stick with |
Below is my "philosophy", which could be totally wrong, please don't take it as gospel :) Ok, so there are two separate concerns we are trying to address: code modularity and code reusability. Packages (crates) are only needed for reusability -- so that other projects can use some functionality directly, without the need to use the whole project. We should only publish crates that we feel fit that description - smallish self-contained task-oriented reusable pieces of code. On the other hand, we can achieve modularity with a dir tree structure inside a single crate, e.g. updated proposal: keep everything in a single crate |
After sleeping over this and taking in your "philosophy" I found a new solution. I think you are right, except for one point: Crates are not only used for re-usability but also for "packaging" (packing as binary, shared lib, static lib). This is important for the different library targets which are needed for android and iOS. The styles and tilejson should be modules, you are right. So here is my new proposal:
Here are some rules:
Some more thoughts:
|
If we decide at some point that functionality should be published, then we will extract code from |
This sounds much better, thanks!!! |
The text was updated successfully, but these errors were encountered: