use crate::{
stream::StreamBuilder,
types::{Data, MaybeKey, Timestamp},
};
pub trait Sink<K, V, T, S>: super::sealed::Sealed {
fn sink(self, name: &str, sink: S);
}
#[diagnostic::on_unimplemented(message = "Not a Sink:
You might need to wrap this in `StatefulSink::new` or `StatelessSink::new`")]
pub trait StreamSink<K, V, T> {
fn consume_stream(self, name: &str, builder: StreamBuilder<K, V, T>);
}
impl<K, V, T, S> Sink<K, V, T, S> for StreamBuilder<K, V, T>
where
K: MaybeKey,
V: Data,
T: Timestamp,
S: StreamSink<K, V, T>,
{
fn sink(self, name: &str, sink: S) {
sink.consume_stream(name, self)
}
}