tisonkun opened a new pull request, #349:
URL: https://github.com/apache/datasketches-rust/pull/349

   ## Summary
   
   Untyped hash-based data structures in `datasketches` (`HllSketch`, 
`HllUnion`, `CpcSketch`, `ThetaSketch`, `TupleSketch`, `CountMinSketch`, 
`BloomFilter::insert`, and `XorFilterBuilder::update_values`) accept generic 
`T: Hash` inputs by value, while borrows of owned values (`&String`, 
`&Vec<u8>`) hash identically through `core`'s `impl<T: Hash + ?Sized> Hash for 
&T`.
   
   Two filter families diverged from this convention:
   * `BloomFilter::contains` and `BloomFilter::contains_and_insert` accepted 
`&T` without `+ ?Sized`, requiring double references on slices 
(`filter.contains(&"apple")` despite `filter.insert("apple")`) and extra 
borrows on scalars and `hash::value` wrappers.
   * `XorFilterBuilder::update` and `XorFilter::contains` accepted `&T` with 
`T: Hash + ?Sized`, which handled unsized slices (`"apple"`) but still required 
extra borrows on scalars (`&7_u64`) and by-value `hash::value` adapters 
(`&raw_bytes::from_slice(bytes)`), asymmetric with 
`XorFilterBuilder::update_values`.
   
   This PR updates `BloomFilter::contains`, `BloomFilter::contains_and_insert`, 
`XorFilterBuilder::update`, and `XorFilter::contains` to take `item: T` (`T: 
Hash`) by value so every untyped hash-input API in the crate shares one calling 
convention. (`FrequentItemsSketch<T>` retains keys of a fixed type `T: Eq + 
Hash`, so its query methods keep `&Q where T: Borrow<Q>, Q: Eq + Hash + ?Sized` 
to match `HashMap::get`.)
   
   ## Validation
   
   * `cargo x check`
   * `cargo x test`
   * `cargo x lint`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to