-
Notifications
You must be signed in to change notification settings - Fork 96
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 experimental feature flagged no_std support #28
Conversation
The default use_std feature flag controls whether or not to compile in #![no_std] mode. The alloc feature flag must be specified and the toolchain fixed to nightly-2018-03-07 for the no_std experimental mode to operate, due to the core::io handling.
Ah this is pretty cool! Another possibility here is to just not provide the streaming search routines for Also, we'll want to keep rust-lang/regex#474 in mind when coming up with the name of the feature here. I wish I just used |
Sure, if restricting the availability of std::io related methods/types in no_std mode is an acceptable option, I'm cool with taking that route. I guess the open question there is whether At very least it might provide a low-maintenance route forward until the portability working group (see rust-lang-nursery/portability-wg#12 ) or some other interested party following rust-lang/rfcs#2262 makes progress on refactoring std/core io for better modularity. |
Yeah regex certainly does not need the io::Read APIs. Not yet, anyway. :) |
327324e
to
312a124
Compare
Updated to change the name of the feature flag to "std" and to exclude the std::io-dependent streaming portions of the API when building without the "std" flag. This allows the removal of the strange nightly pinning dependency, and lets us add the previously-incompatible |
... and I've taken The library documentation has also been updated to include a basic |
@ZackPierce I'm going to close this out. While in principle I support the idea of a Additionally, I should be working on #34 soon, which will likely involve a rebuild of much of this crate from the ground up. While doing that, I'll try to think more carefully about the |
What
The addition of feature flags, optional dependencies, and conditional compilation blocks to make aho-corasick work in either
std
orno_std
+alloc
environments.The default-on "use_std" feature flag controls whether or not to compile in
#![no_std]
mode.The alloc feature flag must be specified and the toolchain fixed to nightly-2018-03-07 for the no_std experimental mode to operate, due to the rather unpleasant pinning of
core_io
to particular versions.How
To build for std, nothing changes.
cargo build
To build for no_std:
The test suites pass as normal in either mode, with the exception of one which relies on
HashSet
, which is not readily available inalloc
, and one doc-test that makes use of the filesystem.Why
This PR is part of a thought experiment regarding what it will take to get
regex
and its dependencies to operate inno_std
+alloc
mode. In particular, it is aimed to prompt discussion about whether the general approach is acceptable and feel out options for the "io in no_std" situation. The option used in this experiment thus far, https://github.com/jethrogb/rust-core_io , is thoroughly unofficial and, as mentioned, is both unfortunately version-pinned and somewhat annoying to interoperate.