You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Additional constructors/possible-classification for std::bitv #2964
I have written these functions for my own use, but I would like it better if they were inside std::bitv:
/**
* Transform a byte-vector into a bitv. Each byte becomes 8 bits,
* with the most significant bits of each byte coming first. Each
* bit becomes true if equal to 1 or false if equal to 0.
*/
fn from_bytes(bytes: [u8]) -> bitv;
/**
* Transform a [bool] into a bitv by converting each bool into a bit.
*/
fn from_bools(bools: [bool]) -> bitv;
/**
* Create a bitv of the specified length where the value at each
* index is f(index).
*/
fn from_fn(len: uint, f: fn(index: uint) -> bool) -> bitv;
(there are also corresponding to_bytes/to_bools methods).
As a separate but related issue, I think it would be nice if the bitv type was turned into a class and its internal data marked as private members.
As either of these requests pleasing to you? I can provide pull requests (with tests/docs/etc) if they are.
There's already a bug for the second issue: #2341 - I actually have a patch for this, but it's not working and I haven't gotten around to figuring out why.
Feel free to submit a pull request for the added functions! Thanks!
Activity
catamorphism commentedon Jul 19, 2012
There's already a bug for the second issue: #2341 - I actually have a patch for this, but it's not working and I haven't gotten around to figuring out why.
Feel free to submit a pull request for the added functions! Thanks!
catamorphism commentedon Jul 20, 2012
Closing this, but please do submit that pull request.
add additional Bitv constructors (as proposed in issue #2964)
Automatic cargo update to 2024-01-01 (rust-lang#2964)
Merge pull request rust-lang#2964 from jyn514/x-fixups
Merge rust-lang#2964