Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to interact with
meowhash::MeowHasher
functions implementingdigest::Digest
(required, for example, to calculate the hash of astream without buffering it in-memory entirely), it's necessary for
downstream users to
use digest::Digest
to gain access to the impl.There are two problems:
meowhash
users need to add two dependencies to theirCargo.toml
file in order to use this crate (a dependency on
meowhash
and adependency on
digest
), anddigest
, youhave to find out what version
meowhash
is using internally andmatch that version when declaring the dependency, otherwise two
versions of the
digest
crate end up being used: one being theversion
meowhash
depends on, and the other being thedigest
version pulled in by the updated
Cargo.toml
. They're incompatible,so putting
use digest::Digest
in your code and then trying to use<MeowHasher as Digest>::update(...)
causes rustc to emit errorsbecause
MeowHasher
doesn't actually implement the samedigest::Digest
that one is using.digest
dependency against that used bymeowhash
, if you evercargo upgrade
there's a very good chanceeverything will break again.
The solution for this in the rust ecosystem is to
pub use
yourexternal dependency. You could probably get away with just
pub use digest::Digest
instead ofpub use digest
since the latest version ofmeowhash
doesn't expose anydigest
API members other than theDigest
trait (generic_array
is no longer exposed), but justre-exporting the entire crate seems to be the preferred approach in the
crate ecosystem and it's less of a maintenance burden down the line (in
case you do end up using something else from the
digest
crate in yourpublic API once again).