use core::hash::Hash;
use super::sealed::Sealed;
pub trait WireSource: Sealed {
type Payload<'a>;
type TypeKey: Hash + Eq + Clone;
fn type_key(payload: &Self::Payload<'_>) -> Self::TypeKey;
fn column_name<'a>(payload: &'a Self::Payload<'_>) -> &'a str;
}
pub trait WireColumnTypes<Src: WireSource> {
fn column_type_key(&self, column_index: usize) -> Src::TypeKey;
}
pub trait WireSchema<Src: WireSource> {
type Table: crate::schema::NamedColumns + WireColumnTypes<Src>;
fn get(&self, table_name: &str) -> Option<&Self::Table>;
}
pub trait Digestable<F, T, S, B>
where
F: crate::builders::Format<S, B>,
T: crate::schema::NamedColumns + WireColumnTypes<Self::Src>,
{
type Src: WireSource;
type Error;
fn digest_into<Sch, A>(
&self,
builder: crate::builders::DiffSetBuilder<F, T, S, B>,
schema: &Sch,
adapter: &A,
) -> Result<crate::builders::DiffSetBuilder<F, T, S, B>, Self::Error>
where
Sch: WireSchema<Self::Src, Table = T>,
A: super::WireAdapter<Self::Src, S, B>;
}