-
Notifications
You must be signed in to change notification settings - Fork 13.7k
collections::bitv: add several Vec methods to Bitv #15139
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
Adds to Bitv the methods: - .push() and .pop() which take and return bool, respectively - .collect() to get a Bitv from a bool-yielding iterator - .truncate() truncates a Bitv to a specific length - .len() returns the number of bits stored in the Bitv
I was under the impression that the |
Oh, my bad, the description of I'm happy to write code to merge these (and introduce more Vec-like functionality) if there would be support for that. |
Oh dear, I think both of these types are a little out of date! I think that Perhaps the methods could be added to |
Ok, it is not much work at all to move these functions into My feeling is that we should merge these two data structures into a single Is this a dramatic enough change to warrant an RFC? Note that What are your thoughts? |
Sounds like |
Thanks Alex. I'm cutting into the code now to merge the data structures, and there are some... interesting things. For one thing, Also, the existing code is not very performant at all. For example, on every Also there is some very creative use of iterators, most of which can be greatly simplified and made more efficient. Perhaps this is an artifact of Rust's immaturity when the module was written; And perhaps there is more that remains to be seen. :) So I'm going to close this, and I'll submit a new PR "revamp |
I think this should be converted into an external iterator (e.g. the equlvaient things on (Thanks for taking on this task ❤️) |
Indeed, as @huonw mentioned, these are ancient methods! If they don't make it through in the rewrite, it's probably not the end of the world.
Oh dear!
We weren't clever enough when this was written :)
Awesome! I'll definitely chime in with @huonw and say thanks for taking this on! |
The types `Bitv` and `BitvSet` are badly out of date. This PR: - cleans up the code (primarily, simplifies `Bitv` and implements `BitvSet` in terms of `Bitv`) - implements several new traits for `Bitv` - adds new functionality to `Bitv` and `BitvSet` - replaces internal iterators with external ones - updates documentation - minor bug fixes This is a significantly souped-up version of PR #15139 and is the result of the discussion there.
Adds to Bitv the methods: