Skip to content

Conversation

rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Nov 24, 2018

Recently I wanted to use a bitvec in WASM in a project of mine. This PR adds an std feature which is enabled by default. When the feature is not enabled, the crate is compiled with no-std and draws on the alloc crate for certain types and traits. This means that compiling this crate for no-std currently requires a nightly compiler, although this is OK for my uses.

The API when compiling with std is backwards-compatible with the previous state.

@rphmeier
Copy link
Contributor Author

Please let me know if I should add a changelog item to this as well.

@myrrlyn
Copy link
Collaborator

myrrlyn commented Nov 25, 2018

Hi! This is great, and something I've been wanting to include for some time. Thanks so much for writing it!

I'm going to accept it as-is, and then add more distinction between: neither alloc nor std, alloc but not std, both alloc and std.

The end result, when I publish 0.8, will require the following configuration in order to use in yes-alloc-no-std environments:

[dependencies.bitvec]
default-features = false
features = ["alloc"]

no-alloc-no-std environments will have access to BitSlice, but not BitVec or bitvec!.

@myrrlyn myrrlyn merged commit 505a024 into ferrilab:master Nov 25, 2018
myrrlyn pushed a commit that referenced this pull request Nov 25, 2018
@rphmeier
Copy link
Contributor Author

rphmeier commented Nov 25, 2018

@myrrlyn Thanks for the quick turnaround! Having BitSlice available to no-std and no-alloc environments is a good option. Please let me know if I can help with this.

@myrrlyn
Copy link
Collaborator

myrrlyn commented Nov 25, 2018

Commit 3fe2b56 adds the alloc feature. Let me know if you have any problems with it.

@rphmeier
Copy link
Contributor Author

rphmeier commented Nov 25, 2018

Seems to work. Thanks

@rphmeier rphmeier deleted the rh-no-std branch November 26, 2018 16:24
myrrlyn added a commit that referenced this pull request Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants