use crate::multi_vector::{MatRef, MaxSimElement, MaxSimError, Standard};
pub trait MaxSimKernel<T: MaxSimElement>: Send + Sync + std::fmt::Debug {
fn nrows(&self) -> usize;
fn compute_max_sim(
&self,
doc: MatRef<'_, Standard<T>>,
scores: &mut [T::Score],
) -> Result<(), MaxSimError>;
}
pub trait Erase<T: MaxSimElement> {
type Output;
fn erase<K: MaxSimKernel<T> + 'static>(self, kernel: K) -> Self::Output;
}
#[derive(Debug, Clone, Copy)]
pub struct BoxErase;
impl<T: MaxSimElement> Erase<T> for BoxErase {
type Output = Box<dyn MaxSimKernel<T>>;
fn erase<K: MaxSimKernel<T> + 'static>(self, kernel: K) -> Self::Output {
Box::new(kernel)
}
}