Pipeline Core
Pipeline Core is a lightweight, type-safe library for building linear and concurrent processing pipelines in Rust. It utilizes dependency injection pattern similar to Bevy engines SystemParam to manage state and inputs cleanly.
Key Features
- Linear Composition: Chain async functions seamlessly to build processing workflows.
- Dependency Injection: Access shared resources (
Res,ResMut) or inputs (Input) directly in your function signatures. - Type Safety: Compile-time checks ensure pipeline stages connect correctly.
- State Management: Built-in
Sharedcontainer for managing global or scoped application state.
Getting Started
1. Basic Linear Pipeline
You can chain handlers (functions) together using .pipe() and .connect().
use ;
// Step 1: Takes an integer, returns an integer
async
// Step 2: Takes an integer, returns a string
async
async
2. Using Shared Resources & Mutation
You can inject shared state into any handler using Res (read-only) and ResMut (mutable).
use ;
// This handler updates the shared log AND processes the input
async
async
API Overview
Core Concepts
Handler: Any async function that takes arguments implementingFromContext.Context<I>: Holds the current inputIandSharedresources.Input<I>: A wrapper to extract the current input from the context.Res<T>/ResMut<T>: Wrappers to extract shared resources from the context.
Extension Methods (HandlerExt)
.pipe(): Converts a handler into aPipeline..connect(next_handler): Chains two pipelines linearly..map(inner_pipeline): (If available) ProcessesVec<I>inputs concurrently.