| Crates.io | luigipipes-rs |
| lib.rs | luigipipes-rs |
| version | 0.2.0 |
| created_at | 2025-03-31 05:07:45.283378+00 |
| updated_at | 2025-04-28 08:52:35.258411+00 |
| description | A simple library to write ETL |
| homepage | |
| repository | https://github.com/era/luigipipes-rs |
| max_upload_size | |
| id | 1613028 |
| size | 12,284 |
luigipipes-rs is a Rust library that allows processing items in a sequence through a defined pipeline. Each item originates from a source, is processed through a series of filters, and is then passed to one or more sinks if it meets the filter criteria.
use pipeline::{PipelineBuilder, Pipeline};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let source = Box::new(MySource::new());
let filter = Box::new(MyFilter::new());
let sink = Box::new(MySink::new());
let pipeline = PipelineBuilder::new()
.add_source(source)
.add_filter(filter)
.add_sink(sink)
.build()?;
pipeline.run()?;
Ok(())
}
use pipeline::source::Source;
struct MySource;
impl MySource {
fn new() -> Self { Self }
}
impl Source<String> for MySource {
fn next(&mut self) -> Option<Self::Item> {
Some("Hello, Pipeline!".to_string())
}
}
use pipeline::filter::Filter;
struct MyFilter;
impl MyFilter {
fn new() -> Self { Self }
}
impl Filter<String> for MyFilter {
fn filter(&self, item: &String) -> bool {
!item.is_empty()
}
}
use pipeline::sink::Sink;
struct MySink;
impl MySink {
fn new() -> Self { Self }
}
impl Sink<String> for MySink {
fn save(&self, item: &String) -> Result<(), Box<dyn std::error::Error>> {
println!("Saving: {}", item);
Ok(())
}
}
Contributions are welcome! Feel free to open issues and submit pull requests.
This project is licensed under the MIT License.