All Projects → johannhof → Pipeline.rs

johannhof / Pipeline.rs

Licence: other
☔️ => ⛅️ => ☀️

Programming Languages

rust
11053 projects
macros
77 projects

Projects that are alternatives of or similar to Pipeline.rs

rocket-pipes
Powerful pipes for TypeScript, that chain Promise and ADT for you 🚌 -> ⛰️ -> 🚠 -> 🏂 -> 🚀
Stars: ✭ 18 (-90.43%)
Mutual labels:  pipeline, pipe
pypely
Make your data processing easy
Stars: ✭ 17 (-90.96%)
Mutual labels:  pipeline, pipe
etran
Erlang Parse Transforms Including Fold (MapReduce) comprehension, Elixir-like Pipeline, and default function arguments
Stars: ✭ 19 (-89.89%)
Mutual labels:  pipeline, pipe
pipe
Functional Pipeline in Go
Stars: ✭ 30 (-84.04%)
Mutual labels:  pipeline, pipe
Param pipe
parameterized pipe in elixir: |n>
Stars: ✭ 14 (-92.55%)
Mutual labels:  pipe, pipeline
pipe-trait
Make it possible to chain regular functions
Stars: ✭ 22 (-88.3%)
Mutual labels:  pipeline, pipe
tpack
Pack a Go workflow/function as a Unix-style pipeline command
Stars: ✭ 55 (-70.74%)
Mutual labels:  pipeline, pipe
Onhold
🔊 Play sounds while and after shell jobs complete
Stars: ✭ 146 (-22.34%)
Mutual labels:  pipe, pipeline
Ttyplot
a realtime plotting utility for terminal/console with data input from stdin
Stars: ✭ 532 (+182.98%)
Mutual labels:  pipe, pipeline
Pipeline
Pipeline is a package to build multi-staged concurrent workflows with a centralized logging output.
Stars: ✭ 433 (+130.32%)
Mutual labels:  pipe, pipeline
Hookah
A cross-platform tool for data pipelines.
Stars: ✭ 83 (-55.85%)
Mutual labels:  pipe, pipeline
Fluids
Fluid dynamics component of Chemical Engineering Design Library (ChEDL)
Stars: ✭ 154 (-18.09%)
Mutual labels:  pipe, pipeline
Operator
Kubernetes operator to manage installation, updation and uninstallation of tektoncd projects (pipeline, …)
Stars: ✭ 161 (-14.36%)
Mutual labels:  pipeline
Vectorsql
VectorSQL is a free analytics DBMS for IoT & Big Data, compatible with ClickHouse.
Stars: ✭ 171 (-9.04%)
Mutual labels:  pipeline
Aws Serverless Cicd Workshop
Learn how to build a CI/CD pipeline for SAM-based applications
Stars: ✭ 158 (-15.96%)
Mutual labels:  pipeline
Spacy Wordnet
spacy-wordnet creates annotations that easily allow the use of wordnet and wordnet domains by using the nltk wordnet interface
Stars: ✭ 156 (-17.02%)
Mutual labels:  pipeline
Pipelines
Machine Learning Pipelines for Kubeflow
Stars: ✭ 2,607 (+1286.7%)
Mutual labels:  pipeline
Plex
Open Source Pipeline for Maya, Houdini, 3ds Max and Nuke .
Stars: ✭ 170 (-9.57%)
Mutual labels:  pipeline
Batchflow
BatchFlow helps you conveniently work with random or sequential batches of your data and define data processing and machine learning workflows even for datasets that do not fit into memory.
Stars: ✭ 156 (-17.02%)
Mutual labels:  pipeline
Pipe
🎷 B3log 分布式社区的 Go 博客端节点系统,欢迎加入下一代社区网络。B3log distributed community blog-end node, welcome to join the next generation community network.
Stars: ✭ 169 (-10.11%)
Mutual labels:  pipe

pipeline.rs

Pipeline is a macro collection to pipe your functions calls, like in F# or Elixir. Instead of the nice |> operator it uses => as a pipe character, due to limitations in the Rust macro system.

Usage

Put this in your Cargo.toml

[dependencies]

pipeline = "0.5.0"

Then you can import the macros with extern crate and macro_use

#[macro_use]
extern crate pipeline;

Examples

// pipe_res exits the pipeline early if a function returns an Err()
let result = pipe_res!("http://rust-lang.org" => download => parse => get_links)
fn times(a: u32, b: u32) -> u32{
    return a * b;
}

let num = pipe!(
  4
  => (times(10))
  => {|i: u32| i * 2}
  => (times(4))
);

// takes a string length, doubles it and converts it back into a string
let length = pipe!(
    "abcd"
    => [len]
    => (as u32)
    => times(2)
    => [to_string]
);

Macros

  • pipe! is the "standard" pipe macro
  • pipe_res! works like pipe! but takes only functions that return a Result (of the same type) and returns early if that result is an Err. Useful for combining multiple IO transformations like opening a file, reading the contents and making an HTTP request.
  • pipe_opt! works like pipe! but takes only functions that return an Option (of the same type). The pipeline will continue to operate on the initial value as long as None is returned from all functions. If a function in the pipeline returns Some, the macro will exit early and return that value. This can be useful if you want to try out several functions to see which can make use of that value in a specified order.

Syntax Features

Any pipe starts with an expression as initial value and requires you to specify a function to transform that initial value.

let result = pipe!(2 => times2);

You can get more fancy with functions, too, if you add parentheses like in a normal function call, the passed parameters will be applied to that function after the transformed value.

You have to put it in parentheses because the Rust macro system can be very restrictive. If you figure out a way to do it without please make a PR.

let result = pipe!(2 => (times(2)));

You can pass closures \o/! A closure must be wrapped in curly brackets ({})

let result = pipe!(
  2
  => (times(2))
  => {|i: u32| i * 2}
);

If you want a function to be called as a method on the transform value, put it in square brackets ([]).

let result = pipe!(
    "abcd"
    => [len]
);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].