Skip to main content

SegmentProcessor

Trait SegmentProcessor 

pub trait SegmentProcessor: Send {
    // Required methods
    fn name(&self) -> &'static str;
    fn process(
        &mut self,
        data: SegmentData,
    ) -> Pin<Box<dyn Future<Output = Result<SegmentData, ProcessError>> + Send + '_>>;
}
Available on crate feature dial9 only.
Expand description

A single step in the segment processing pipeline.

Implementations handle one concern: compress, symbolize, upload, etc. The worker calls processors in sequence for each segment.

§Panic safety

The worker loop catches panics from process() and skips the panicking segment. The same processor instance is reused for subsequent segments, so implementations must remain in a valid state after a panic (i.e., no partially-updated invariants that would cause incorrect behavior on the next call).

Required Methods§

fn name(&self) -> &'static str

Human-readable name for this processor (used in metrics).

fn process( &mut self, data: SegmentData, ) -> Pin<Box<dyn Future<Output = Result<SegmentData, ProcessError>> + Send + '_>>

Process a segment, transforming or consuming its data. Returns the (possibly modified) data for the next processor, or an error to skip this segment.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§