Provide option to avoid importing `rand` crate when not required
satyarohith opened this issue · 1 comments
satyarohith commented
Please correct me if my assumption is wrong. The rand
crate is used for RandomXxHashBuilder64
and friends but is probably not required when using the std builder.
The below code also pulls in rand
as a dependency. It would be nice to have something like the features = ["xxhash64"]
option to avoid pulling rand
.
use std::hash::BuildHasher;
use std::hash::BuildHasherDefault;
use std::hash::Hasher;
use twox_hash::XxHash64;
fn main() {
let mut hasher = BuildHasherDefault::<XxHash64>::default().build_hasher();
hasher.write(b"hello world");
println!("Hello, world!");
}
shepmaster commented
Can you try disabling the std
feature?
Your code example compiles with:
[dependencies]
twox-hash = { version = "1.6.1", default-features = false }
% cargo tree
example v0.1.0 (/private/tmp/example)
└── twox-hash v1.6.1
├── cfg-if v1.0.0
└── static_assertions v1.1.0