ZENOTME commented on code in PR #151:
URL: https://github.com/apache/datasketches-rust/pull/151#discussion_r3650418071
##########
datasketches/src/theta/intersection.rs:
##########
@@ -61,7 +63,12 @@ impl ThetaIntersection {
/// The intersection can be viewed as starting from the "universe" set,
/// and every update can reduce the current set to leave the overlapping
/// subset only.
- pub fn update<S: ThetaSketchView>(&mut self, sketch: &S) -> Result<(),
Error> {
+ #[allow(private_bounds)]
+ pub fn update<V>(&mut self, sketch: ThetaSketchView<V>) -> Result<(),
Error>
+ where
+ V: RawThetaSketchView<ThetaEntry>,
+ {
Review Comment:
Another way is to export using new trait like `TupleSketchView`. We don't
need to test it, and it can be sealed::Sealed. And thetacommon can internal and
not export to user.
```
pub trait TupleSketchView<S>: sealed::Sealed {
/// Return the 16-bit seed hash.
fn seed_hash(&self) -> u16;
/// Return theta as a `u64` threshold.
fn theta(&self) -> u64;
/// Return whether this sketch has not received any updates.
fn is_empty(&self) -> bool;
/// Return whether retained entries are ordered by ascending hash.
fn is_ordered(&self) -> bool;
/// Return an iterator over retained entries.
fn iter(&self) -> impl Iterator<Item = TupleEntry<S>> + '_;
/// Return the number of retained entries.
fn num_retained(&self) -> usize;
}
impl<S, T> RawThetaSketchView<TupleEntry<S>> for T
where
T: TupleSketchView<S> + ?Sized,
{
fn seed_hash(&self) -> u16 {
TupleSketchView::seed_hash(self)
}
fn theta(&self) -> u64 {
TupleSketchView::theta(self)
}
fn is_empty(&self) -> bool {
TupleSketchView::is_empty(self)
}
fn is_ordered(&self) -> bool {
TupleSketchView::is_ordered(self)
}
fn iter(&self) -> impl Iterator<Item = TupleEntry<S>> + '_ {
TupleSketchView::iter(self)
}
fn num_retained(&self) -> usize {
TupleSketchView::num_retained(self)
}
}
```
--
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]