Closed apoelstra closed 4 months ago
I see. The caller cannot match the returned enum u2
and there are no From<u2>
implementations.
I'm not 100% convinced of the usefulness of read_u2
as a public method. We use it because the Simplicity bit encoding happens to work in terms of 2 bits sometimes. Downstream users can use read_u2
to decode their own custom bit encoding. Is that an intended use case of the library? Making the bit iterator interface private would turn the iterator into an opaque type used for Simplicity parsing only, though.
Is that an intended use case of the library?
It's what I'm trying to do, yes.
I think if Simplicity is going to have a bit encoding it should have "general-purpose" bit decoding methods. You need these to manipulate Simplicity encodings directly, which is sometimes needed because the library doesn't let you work with many kinds of malformed/incorrectly typed/etc objects. Its Value
handling is also really inefficient.
BitIter::read_u2
is unusable because its return type is not exported