use super::TuneInputs;
#[diagnostic::on_unimplemented(
message = "`{Self}` is not a valid key generator",
label = "invalid key generator"
)]
pub trait KeyGenerator<K, I: TuneInputs>: Send + Sync + 'static {
fn generate(&self, inputs: &I::At<'_>) -> K;
}
impl<K, I, Func> KeyGenerator<K, I> for Func
where
I: TuneInputs,
Func: Send + Sync + 'static,
for<'a> Func: Fn(&I::At<'a>) -> K,
{
#[inline]
fn generate<'a>(&self, inputs: &I::At<'a>) -> K {
(self)(inputs)
}
}