-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add no_std compatibility #1485
Comments
Marking for |
This needs some work and depend on the demand (cli in environments where you want no_std is niche iirc). We can push this for a future release |
I agree, this is not breaking if we just add a new feature to cargo. We can push this. |
You'll want to add a |
@BurntSushi Thanks for the input. I haven't worked with |
Yes it is standard. Features should be additive, since enabling them in a dependency enables it for all instances of that crate in a dependency tree. The main point here is to make sure you add the feature in clap 3, so that you can add it later in a backwards compatible fashion. (I would personally be surprised if making clap compatible with no_std was easy without significant changes to the public API. Perhaps an alloc-only version would be simpler. But I confess that I have not thought deeply about it.) |
Don't worry. I'll handle the no_std part. Well generally the default crate should be in no_std and then std is added as a new feature. The problem with that is it is difficult to do it in a non-breaking way. Also I don't want to keep the release waiting for it, so likely it will happen in a minor release in the future in a non-breaking (or a short term solution ) or properly in 4.0 |
@Dylan-DPC Hmmm, I'm not sure if I conveyed my thoughts well enough. What I'm saying here is that with the clap 3 initial release, you can add a This is exactly the approach that the |
I've added a dummy no-op feature in 6aaeb27 |
It would also be very useful to be able to derive E.g.:
where |
Support for |
This ticket looks pretty stale. I just tested the no_std in 4.5.11 and see its still dependent on std. As someone trying to compile for UEFI i'd support this feature, but would also appreciate the clarity of closing this issue if its not being considered anymore |
Just because something is stale doesn't mean it won't be considered any more. There are lots of features of interest and limited capacity to move them forward. |
Feature Request Summary
Would it be possible to split clap argument parsing logic into a
no_std
"clap_core" crate or allow crates to toggle ano_std
style feature.This would probably strip most of the clap features such as
print_help()
, exiting on error, loading from yaml, etc... but the core argument parsing logic should still work.no_std
clap could expose a.get_matches_from()
like function which could return aClapResult<ArgMatches<'a>>
leaving the error handling up to the caller. Optionally,no_std
clap could also expose ways to get pre-formated help/long_help buffers for crates who wish to display the information.Current Behavior
Clap is incompatible with
no_std
The text was updated successfully, but these errors were encountered: