Skip to main content

Crate pipei

Crate pipei 

Source
Expand description

§pipei

A zero-cost library for chaining multi-argument functions using method syntax.

It turns a standard function call f(x, y, z) into a method call x.pipe(f)(y, z).

§Core API

  • Pipe::pipe: Passes the value into a function and returns the result.
  • Tap::tap: Inspects or mutates the value, then returns the original value.
  • TapWith::tap_with: Inspects or mutates a projection of the value, then returns the original value.
fn add(a: i32, b: i32) -> i32 { a + b }

// Equivalent to add(10, 5)
let result = 10.pipe(add)(5);

assert_eq!(result, 15);

Structs§

Imm
Marker: pass the pipeline value immutably (&T).
Mut
Marker: pass the pipeline value mutably (&mut T).
Own
Marker: pass/return the pipeline value by value (T).
PipeMark
Marker selecting pipe semantics (return transform result).
TapMark
Marker selecting tap semantics (return original value).

Traits§

ImplCurry
Internal mechanism: Prepares a step starting from an owned value or direct reference.
ImplCurryWith
Internal mechanism: Prepares a step with a projection.
Pipe
Extension trait for transforming values.
Tap
Extension trait for running side effects without altering the pipeline value.
TapWith
Extension trait for running side effects on a projection of the value.