Open
Description
The method DigestOf::digest_with
is arguably too loose for library API: it allows any closure to calculate a digest of an object, which is however, tied to the object type by its type parameter.
To reduce possibility of sneaky errors, this method should be replaced by a different method using a new trait similar to std::hash::Hash
, which object types would need to implement to support calculation of a digest on their contents in a single canonical way.
DigestOf::coerce
suffers from similar looseness, but at least its intent is explicit in the code. Its only usage so far is in a quickcheck Arbitrary
impl for DigestOf
, which is rather hackish.