apache_datasketches/theta/
input.rs1use super::{CompactThetaSketch, ThetaSketch, WrappedCompactThetaSketch};
2use apache_datasketches_sys::theta_input::ThetaInputRef;
3
4mod sealed {
5 pub trait Sealed {}
6 impl Sealed for super::ThetaSketch {}
7 impl Sealed for super::CompactThetaSketch {}
8 impl<'a> Sealed for super::WrappedCompactThetaSketch<'a> {}
9}
10
11pub trait ThetaInput: sealed::Sealed {
16 #[doc(hidden)]
17 fn as_theta_input(&self) -> ThetaInputRef<'_>;
18}
19
20impl ThetaInput for ThetaSketch {
21 fn as_theta_input(&self) -> ThetaInputRef<'_> {
22 ThetaInputRef::Sketch(&self.inner)
23 }
24}
25
26impl ThetaInput for CompactThetaSketch {
27 fn as_theta_input(&self) -> ThetaInputRef<'_> {
28 ThetaInputRef::Compact(&self.inner)
29 }
30}
31
32impl<'a> ThetaInput for WrappedCompactThetaSketch<'a> {
33 fn as_theta_input(&self) -> ThetaInputRef<'_> {
34 ThetaInputRef::Wrapped(&self.inner)
35 }
36}