Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Pipex 🚀
A powerful functional pipeline macro for Rust that combines synchronous, asynchronous, and parallel operations with extensible error handling strategies.
✨ Features
- 🔄 Sync Operations: Chain regular synchronous transformations
- ⚡ Async Operations: Handle asynchronous work
- 🚀 Parallel Processing: Leverage multiple CPU cores with Rayon
- 🛡️ Error Handling: Extensible error handling strategies via proc macros
- 🔀 Mixed Workloads: Seamlessly combine different operation types
- 📦 Modular: Optional features for async and parallel processing
🚀 Quick Start
Add this to your Cargo.toml
:
[]
= ["async", "parallel"]
= []
= []
[]
= { = "0.1.13", = ["full"] }
= { = "1", = ["full", "macros", "rt-multi-thread"] }
Error Handling Strategies
use *;
async
async
async
Parallel Processing
use pipex;
async
📖 Pipeline Syntax
Syntax | Description | Example | Requires Feature |
---|---|---|---|
|x| expr |
Synchronous transformation | |x| Ok::<_, String>(x * 2) |
None |
async |x| { ... } |
Asynchronous operation | async |x| { fetch(x).await } |
async |
||| |x| { ... } |
Parallel processing | ||| |x| { cpu_work(x) } |
parallel |
🛡️ Error Handling Strategies
Pipex provides several built-in error handling strategies:
Strategy | Description | Behavior |
---|---|---|
IgnoreHandler |
Ignore errors | Only successful results are kept |
CollectHandler |
Collect all | Both success and error results are kept |
FailFastHandler |
Fail fast | Only error results are kept |
LogAndIgnoreHandler |
Log and ignore | Errors are logged to stderr, then ignored |
Custom Error Handlers
You can implement your own error handling strategies:
use *;
// Example: A handler that collects only successful results and reverses their order.
;
async
Registering Custom Strategies
For pipex
to recognize and use your custom error handlers with specific data types (e.g. Result<i32, String>
), you may need to register them. This is typically done once, for instance, at the beginning of your main
function, using the register_strategies!
macro.
This macro ensures that the procedural macros used by pipex
can correctly associate your handlers with the functions they annotate.
use *;
// Assuming LastErrorHandler and ReverseSuccessHandler are defined structs
// that implement the ErrorHandler<T, E> trait. For example:
;
; // As defined in the example above
📚 Complete Examples
Data Processing Pipeline
use *;
async
async
📋 Requirements
- Rust 1.75.0 or later
- For async features: tokio runtime
- For parallel features: compatible with rayon
🔧 Contributing
Contributions are welcome! Please see our contributing guidelines.
📄 License
This project is licensed under the MIT License - see the LICENSE-MIT file for details.