Skip to main content

Crate pipei

Crate pipei 

Source
Expand description

§pipei

A zero-cost library for composing function calls into fluent pipelines with precise lifetime control.

Intuitively, the .pipe() operator transforms a function f(x, y, z) into a method call x.pipe(f)(y, z).

§Core API

  • Pipe::pipe: Transforms the value and returns the new value.
  • PipeRef::pipe_ref: Starts a pipe from a mutable reference to derive a borrowed value.
  • Tap::tap: Runs a side-effect (logging, mutation) and returns the original value.
  • TapWith::tap_with: Projects the value (e.g., gets a field), runs a side-effect on the projection, and returns the original value.
fn add(a: i32, b: i32) -> i32 { a + b }

// Correct:
// 10i32.pipe(add)(5);

// Incorrect (function is prepared but never called):
// 10i32.pipe(add);

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.
ImplCurryRef
Internal mechanism: Prepares a step starting specifically from &'a mut A0.
ImplCurryWith
Internal mechanism: Prepares a step with a projection.
Pipe
Extension trait for transforming values.
PipeRef
Extension trait for safe re-borrowing chains.
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.