-
Notifications
You must be signed in to change notification settings - Fork 204
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
no_std
support for geo-types
#936
Conversation
Hello! Thanks for taking a pass at this. Firstly, I'm not sure if we should be trying to support The But I'm a little hesitant about the What do people think about going the route that rstar went, which is no_std but requiring alloc outright? Also, I think to have any hope of not breaking this in the future we'd need to be sure the no_std build is added to CI. |
Agreed we should start out by having |
Agreed w/both. |
I added the I'll go ahead and remove the
I'll add a build on a bare metal ARM target that can't provide My other question is whether to add
Agreed, it's not as simple. I'll take another look at it, perhaps after this is complete, and open a PR for that discussion only if it's not too bad. |
I've done very little with no_std. What is common across the no_std ecosystem? What's the cost? What's the benefit? |
I don't have all that much experience with |
@wetheredge Are you still working on this? I think the next step is to require alloc for no_std, instead of making it optional |
Looks like the current CI does run with |
I think it makes sense to add a |
Oh disregard my last message, I misread yours. Let me think about this |
https://github.com/hobofan/cargo-nono looks nice. It hasn't been updated very recently, but maybe that's a sign of maturity vs. abandonment. |
My vote would be to try adding a new no-std target (e.g. |
I've used Most of the features are |
Let's disable |
Unless I've missed something, this should be ready. |
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! thank you! will leave it open for another day or two to see if anyone else has feedback
This LGTM, thanks! Is this a breaking change that would necessitate bumping semver? In particular, I'm thinking that introducing a default feature and disabling default features for some of our deps might break things for people. |
Re semver: The cargo docs aren't entirely clear on adding a new default feature that controls existing functionality. I'd be inclined to say it's technically a major change, but since there weren't any default features before, perhaps you could get away with treating it as minor. Following the same guidelines, disabling features on dependencies only needs to be a minor change since, as RFC 1105 says, any crate relying on those features without enabling them themselves is a bug. |
Is this ready to merge? |
Thanks for your patience! bors r+ |
936: `no_std` support for `geo-types` r=frewsxcv a=wetheredge - [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/main/CODE_OF_CONDUCT.md). - [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users. --- This is my take on `no_std` support. This adds a new `std` that behave similarly to `serde`'s. Rough overview of my changes: - For the most part, simply swapping `alloc` or `core` in for `std`. - Also added a second `doc(hidden)` public module (`_alloc`) to give macros access to `Vec` and `Box` even if the crate they are used from does not have `extern crate alloc`. This could be merged into the existing `private_utils`. It could also be dropped entirely, but that would require modifying the macros to reference `std` when that feature is enabled and the cleanest way I found to do that is still somewhat ugly: match on `()` with `cfg`'d branches. I've looked some at #426 and the main difference I see is that it adds `core-error` for the `Error` trait, while I've just put that behind the `std` feature. If that is preferred, I can add the dependency. --- I have also started working on `no_std` support in `geo`, but it's not quite as straight-forward, so I was keeping it for a second PR. fixes #422, partially supersedes #426 Co-authored-by: William Etheredge <[email protected]>
Build failed: |
It looks like |
Oops was installing thumbv6 but building with v7…. Looks like it's fixed. |
bors r+ |
Build succeeded: |
Thanks for seeing this through @wetheredge! |
CHANGES.md
if knowledge of this change could be valuable to users.This is my take on
no_std
support. This adds a newstd
that behave similarly toserde
's.Rough overview of my changes:
alloc
orcore
in forstd
.doc(hidden)
public module (_alloc
) to give macros access toVec
andBox
even if the crate they are used from does not haveextern crate alloc
. This could be merged into the existingprivate_utils
. It could also be dropped entirely, but that would require modifying the macros to referencestd
when that feature is enabled and the cleanest way I found to do that is still somewhat ugly: match on()
withcfg
'd branches.I've looked some at #426 and the main difference I see is that it adds
core-error
for theError
trait, while I've just put that behind thestd
feature. If that is preferred, I can add the dependency.I have also started working on
no_std
support ingeo
, but it's not quite as straight-forward, so I was keeping it for a second PR.fixes #422, partially supersedes #426