OperationResult

Trait OperationResult 

Source
pub trait OperationResult:
    Clone
    + Debug
    + Send
    + Sync
    + 'static {
    type Input: Clone + Debug + Send + Sync;
    type Output: Clone + Debug + Send + Sync;
    type Metrics: Clone + Debug + Default + Send + Sync;

    // Required methods
    fn new(input: Self::Input, output: Self::Output) -> Self;
    fn input(&self) -> &Self::Input;
    fn output(&self) -> &Self::Output;
    fn metrics(&self) -> &Self::Metrics;
    fn with_metrics(self, metrics: Self::Metrics) -> Self;
    fn is_success(&self) -> bool;
    fn error(&self) -> Option<&PipelineError>;
}
Expand description

Generic trait for operation results that can be built fluently

This trait defines the interface for operation results that can be constructed using the generic result builder. It provides a type-safe way to define operation results with input, output, and metrics.

§Key Features

  • Type Safety: Generic types for input, output, and metrics
  • Fluent Construction: Support for fluent result building
  • Metrics Integration: Built-in metrics collection and reporting
  • Success Tracking: Track operation success/failure status
  • Extensibility: Extensible design for custom result types

§Type Parameters

  • Input: The input type for the operation
  • Output: The output type for the operation
  • Metrics: The metrics type for performance tracking

§Implementation Requirements

Implementing types must:

  • Be cloneable for result construction
  • Be debuggable for error reporting
  • Be thread-safe (Send + Sync)
  • Have a stable lifetime ('static)

§Examples

Required Associated Types§

Required Methods§

Source

fn new(input: Self::Input, output: Self::Output) -> Self

Creates a new result with input and output

Source

fn input(&self) -> &Self::Input

Gets the input data

Source

fn output(&self) -> &Self::Output

Gets the output data

Source

fn metrics(&self) -> &Self::Metrics

Gets the metrics

Source

fn with_metrics(self, metrics: Self::Metrics) -> Self

Sets the metrics

Source

fn is_success(&self) -> bool

Checks if the operation was successful

Source

fn error(&self) -> Option<&PipelineError>

Gets any error information

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I, O, M> OperationResult for GenericProcessingResult<I, O, M>
where I: Clone + Debug + Send + Sync + 'static, O: Clone + Debug + Send + Sync + 'static, M: Clone + Debug + Default + Send + Sync + 'static,