tuffy / bitstream-io

Library for reading/writing un-aligned values from/to streams in big-endian and little-endian formats
Apache License 2.0
52 stars 20 forks source link

derive Clone on BitQueue, BitReader #8

Closed scottlamb closed 3 years ago

scottlamb commented 3 years ago

This is useful for querying the position within a H.264 bitstream relative to the final one bit; details in dholroyd/h264-reader#28.

The default #![derive(Clone)] behavior is nice: BitReader will be Clone iff the backing std::io::Read is also Clone. Out of paranoia, I added a test that clone works properly and that it's still possible to instantiate a BitReader with a non-Clone R.

scottlamb commented 3 years ago

Thanks for the quick merge and release!