pub struct MapTransformer<F, I, O>where
F: FnMut(I) -> O + Send + Clone + 'static,
I: Debug + Clone + Send + Sync + 'static,
O: Debug + Clone + Send + Sync + 'static,{
pub f: F,
pub config: TransformerConfig<I>,
pub _phantom_i: PhantomData<I>,
pub _phantom_o: PhantomData<O>,
}Expand description
A transformer that applies a function to each item in the stream.
This transformer takes each input item and applies a function to transform it into an output item, creating a one-to-one mapping.
Fields§
§f: FThe function to apply to each input item.
config: TransformerConfig<I>Configuration for the transformer, including error handling strategy.
_phantom_i: PhantomData<I>Phantom data to track the input type parameter.
_phantom_o: PhantomData<O>Phantom data to track the output type parameter.
Implementations§
Source§impl<F, I, O> MapTransformer<F, I, O>
impl<F, I, O> MapTransformer<F, I, O>
Sourcepub fn new(f: F) -> Self
pub fn new(f: F) -> Self
Creates a new MapTransformer with the given function.
§Arguments
f- The function to apply to each input item.
Sourcepub fn with_error_strategy(self, strategy: ErrorStrategy<I>) -> Self
pub fn with_error_strategy(self, strategy: ErrorStrategy<I>) -> Self
Sets the error handling strategy for this transformer.
§Arguments
strategy- The error handling strategy to use.
Trait Implementations§
Source§impl<F, I, O> Clone for MapTransformer<F, I, O>
impl<F, I, O> Clone for MapTransformer<F, I, O>
Source§impl<F, I, O> Input for MapTransformer<F, I, O>
impl<F, I, O> Input for MapTransformer<F, I, O>
Source§impl<F, I, O> Output for MapTransformer<F, I, O>
impl<F, I, O> Output for MapTransformer<F, I, O>
Source§impl<F, I, O> Transformer for MapTransformer<F, I, O>
impl<F, I, O> Transformer for MapTransformer<F, I, O>
Source§type InputPorts = (I,)
type InputPorts = (I,)
The input port tuple type for this transformer. Read more
Source§type OutputPorts = (O,)
type OutputPorts = (O,)
The output port tuple type for this transformer. Read more
Source§fn transform(&mut self, input: Self::InputStream) -> Self::OutputStream
fn transform(&mut self, input: Self::InputStream) -> Self::OutputStream
Transforms a stream of input items into a stream of output items. Read more
Source§fn set_config_impl(&mut self, config: TransformerConfig<I>)
fn set_config_impl(&mut self, config: TransformerConfig<I>)
Sets the configuration implementation. Read more
Source§fn get_config_impl(&self) -> &TransformerConfig<I>
fn get_config_impl(&self) -> &TransformerConfig<I>
Returns a reference to the configuration implementation. Read more
Source§fn get_config_mut_impl(&mut self) -> &mut TransformerConfig<I>
fn get_config_mut_impl(&mut self) -> &mut TransformerConfig<I>
Returns a mutable reference to the configuration implementation. Read more
Source§fn handle_error(&self, error: &StreamError<I>) -> ErrorAction
fn handle_error(&self, error: &StreamError<I>) -> ErrorAction
Handles an error that occurred during stream processing. Read more
Source§fn create_error_context(&self, item: Option<I>) -> ErrorContext<I>
fn create_error_context(&self, item: Option<I>) -> ErrorContext<I>
Creates an error context for error reporting. Read more
Source§fn component_info(&self) -> ComponentInfo
fn component_info(&self) -> ComponentInfo
Returns information about the component for error reporting. Read more
Source§fn with_config(&self, config: TransformerConfig<Self::Input>) -> Self
fn with_config(&self, config: TransformerConfig<Self::Input>) -> Self
Creates a new transformer instance with the given configuration. Read more
Source§fn set_config(&mut self, config: TransformerConfig<Self::Input>)
fn set_config(&mut self, config: TransformerConfig<Self::Input>)
Sets the configuration for this transformer. Read more
Source§fn config(&self) -> &TransformerConfig<Self::Input>
fn config(&self) -> &TransformerConfig<Self::Input>
Returns a reference to the transformer’s configuration. Read more
Source§fn config_mut(&mut self) -> &mut TransformerConfig<Self::Input>
fn config_mut(&mut self) -> &mut TransformerConfig<Self::Input>
Returns a mutable reference to the transformer’s configuration. Read more
Auto Trait Implementations§
impl<F, I, O> Freeze for MapTransformer<F, I, O>where
F: Freeze,
impl<F, I, O> !RefUnwindSafe for MapTransformer<F, I, O>
impl<F, I, O> Send for MapTransformer<F, I, O>
impl<F, I, O> Sync for MapTransformer<F, I, O>where
F: Sync,
impl<F, I, O> Unpin for MapTransformer<F, I, O>
impl<F, I, O> !UnwindSafe for MapTransformer<F, I, O>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more