streamweave_transformers/zip/
zip_transformer.rs1use std::marker::PhantomData;
2use streamweave::TransformerConfig;
3use streamweave_error::ErrorStrategy;
4
5#[derive(Clone)]
10pub struct ZipTransformer<T: std::fmt::Debug + Clone + Send + Sync + 'static> {
11 pub config: TransformerConfig<Vec<T>>,
13 pub _phantom: PhantomData<T>,
15}
16
17impl<T: std::fmt::Debug + Clone + Send + Sync + 'static> Default for ZipTransformer<T> {
18 fn default() -> Self {
19 Self::new()
20 }
21}
22
23impl<T: std::fmt::Debug + Clone + Send + Sync + 'static> ZipTransformer<T> {
24 pub fn new() -> Self {
26 Self {
27 config: TransformerConfig::<Vec<T>>::default(),
28 _phantom: PhantomData,
29 }
30 }
31
32 pub fn with_error_strategy(mut self, strategy: ErrorStrategy<Vec<T>>) -> Self {
38 self.config.error_strategy = strategy;
39 self
40 }
41
42 pub fn with_name(mut self, name: String) -> Self {
48 self.config.name = Some(name);
49 self
50 }
51}