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§
type Input: Clone + Debug + Send + Sync
type Output: Clone + Debug + Send + Sync
type Metrics: Clone + Debug + Default + Send + Sync
Required Methods§
Sourcefn new(input: Self::Input, output: Self::Output) -> Self
fn new(input: Self::Input, output: Self::Output) -> Self
Creates a new result with input and output
Sourcefn with_metrics(self, metrics: Self::Metrics) -> Self
fn with_metrics(self, metrics: Self::Metrics) -> Self
Sets the metrics
Sourcefn is_success(&self) -> bool
fn is_success(&self) -> bool
Checks if the operation was successful
Sourcefn error(&self) -> Option<&PipelineError>
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.