Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn from_bytes_stream<I, H>(seq_iter: I, build_hasher: &H) -> Self
- where
- I: Iterator<Item=u8>,
- H: BuildHasher,
- {
- let mut dict = HashSet::new();
- let mut hasher = build_hasher.build_hasher();
- for byte in seq_iter {
- hasher.write_u8(byte);
- let hash = hasher.finish() as i32;
- if dict.insert(hash) {
- hasher = build_hasher.build_hasher();
- }
- }
- let mut dict: Vec<_> = dict.iter().cloned().collect();
- dict.sort();
- LZDict { entries: dict.iter().cloned().take(1000).collect() }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement