Skip to content
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

Allow making instances of BitVec with B≠u32 #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Columbus240
Copy link

Previously it was not possible to construct such instances of BitVec other than via the Default trait. Using the *_general methods, one can construct instances of BitVec with arbitrary B. See the examples in the doc comments for the syntax.
In particular the with_capacity function is now available for arbitrary B.

I'm not certain about the following parts and would like some input or changes by the maintainer:

  • The naming of the more general functions. I'm not sure whether the names I gave are appropriate.
  • The documentation. Currently I just copy-paste and adapt the already existing comments, but do not mention the difference between corresponding functions.
  • The existing code for u32 made use of the |= operator (ops::BitOrAssign). I didn't want to change this code, so I added BitOrAssign as requirement for the BitBlock trait. By replacing a |= b with its equivalent form a = a | b, this requirement could be removed.

I haven't checked, whether there is a similar situation in other libraries.

Previously it was not possible to construct such instances of `BitVec`
other than using the `Default` trait.
@pczarn
Copy link
Contributor

pczarn commented May 31, 2024

Not quite sure how to change the API.

@pczarn
Copy link
Contributor

pczarn commented Jul 16, 2024

I have some ideas, but no spare time, please ask me before any work on this.

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