Trait eventify_idx::types::process::Process
source · pub trait Process<T> {
type Error;
// Required methods
fn process<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stream<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stream_latest<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
The Process trait defines asynchronous operations for processing different types of data.
It’s generic over a type T, allowing flexibility in the type of data being processed.
This trait is ideal for scenarios where data needs to be processed, streamed, or monitored in real-time.
Required Associated Types§
Required Methods§
sourcefn process<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Asynchronously processes data of type T.
This method should contain the core logic for processing the data. The specifics of what processing entails (e.g., fetching, parsing, storing) are determined by the implementing type.
sourcefn stream<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Asynchronously streams data of type T.
This method should provide the functionality to continuously stream data. The nature of the streaming (e.g., real-time, batch processing) depends on the implementing type.
sourcefn stream_latest<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream_latest<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Asynchronously streams the latest available data of type T.
This method should specifically focus on streaming the most recent data. It’s useful in scenarios where the latest information is critical, such as real-time monitoring or alerting systems.