-
Notifications
You must be signed in to change notification settings - Fork 9
Replace no_std feature with std feature #48
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
Conversation
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.
Looks good so far. Could you:
- Adapt the CI
.github/workflows/build.yml
changing theno_std
feature to `std? - Add an entry to the changelog
- See if it is possible to use the
std
for the calculations wherelibm
is currently explicitly used and only use thelibm
version in theno_std
case? (e.g here)
Unfortunately I didn't understand your last point about libm, could you rephrase that? Are you suggesting to use libm-based calculations both for std and no_std targets? |
Sorry about that. I mean it would be good to avoid the |
I agree, but I think this is not possible right now (rust-lang/cargo#1839) without introducing a new |
Yeah that is a limitation. We will have to compile it no matter what. However, we could simply not use it and use the |
Agreed, that is already the case in this PR. The only place I could find that uses libm is |
Interesting. Sorry about that. I saw now that the whole functions are simply not available when |
Which ones are you talking about? |
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.
Uh, sorry for my confusion and thanks for bearing with me.
This PR is of course great as it is.
We can enable the trigonometric operations on Angle
when on no-std
with libm
on a separate PR if you are interested.
This PR fixes #23 and fixes #47 by replacing the no_std flag with an additive std flag and disabling default features on serde.
libm is not an optional dependency anymore because it's functions are required in a no_std context. But as they are only used in said context, it should get optimized away if the std flag is enabled.
I'm happy to change that though if anyone has a better suggestion.
I have chosen not to explicitly enable serdes std flag as it is not required in this library and any consuming application will have that enable anyways if they are using serde in an std context, or am I missing a case there?