Description
Writing components that maintain generic CRCs is difficult using this crate because the Width trait is not used to its full extent. While the generic component can demand that a W: Width be specified, many places still require a concrete type because a W: Width is insufficient.
The two places I ran into this was the lack of an .update()
on a digest (it's only implemented for the 5 concrete widths) and the .digest()
method.
I think that it'd be possible to move to generic implementations and leverage the Width trait; code that currently sits in the concrete implementations would move into Width. The change would almost be compatible: As Width is not sealed, the trait would need to gain non-provided methods. (It's a change that's very unlikely to break any code, as just implementing Width doesn't let a user do anything with it so far, but it's technically still breaking).
As a side effect, the built documentation would become much more usable -- for example, the crc::Crc
struct would only have one impl block instead of 5.