digest: reduce the number of required methods in `Digest`?
Closed this issue · 2 comments
It seems that a number of currently required methods in Digest
can be expressed via other methods, for example:
chain_update
viaupdate
finalize
viafinalize_into
finalize_reset
viareset
andfinalize
finalize_into_reset
viareset
andfinalize_into
- possibly,
new
vianew_with_prefix
with an empty slice
Is there a reason it's not currently done?
You mean why those methods don't have blanket impls? It's because those implementations reside in the blanket impl of the trait itself. It uses the underlying traits directly without adding a layer of indirection (i.e. we use Update::update
directly instead of using Digest::update
which in turn uses Update::update
). We could've used blanket methods implementations, but it's a very minor implementation detail considering that Digest
should not be directly implemented by user crates.
Ah, I see, that makes sense. I don't think it would hurt adding the blanket impls still, but I don't insist on it. Closing.