Allow users to specify both ref_in and ref_out when creating Digests.
zachmse opened this issue · comments
In the comments of #37, the ability to specify both ref_in and ref_out was discussed. I also think this capability would be good to add. If this change is made, I think it would be good to update the implementations of Digest
to follow the builder pattern, rather than adding even more parameters to the new_custom()
function. In fact, as the new_custom()
function hasn't been included in a release yet (as far as I can tell), it could even be removed.
For example, I envision something like the following:
// Anything not explicitly set is given a "sane" default value
let mut digest = crc16::Digest::new(poly)
.initial_crc(crc)
.reflection_in(true)
.reflection_out(true);
Ultimately I don't have a strong preference on how these values are set, so feel free to "no change" this issue, but I would be more than happy to prototype the changes if this is something that might be wanted.