Skip to main content

Crate x_pipe_rs

Crate x_pipe_rs 

Source
Expand description

Composable recommendation and feed pipeline framework.

x-pipe-rs provides a typed, composable pipeline for assembling ranked feeds, inspired by the X algorithm’s candidate-pipeline architecture. Every pipeline stage is a Kleisli arrow in the Io monad from comp_cat_rs; composition is Kleisli composition, which by comp-cat-rs’s collapse hierarchy is a Kan extension.

§Architecture

A pipeline assembles six kinds of stages:

  1. Source – produce candidate items from backends
  2. Hydrator – enrich candidates with additional data
  3. Filter – remove candidates that fail criteria
  4. Scorer – assign relevance scores
  5. Selector – choose final candidates (dedup, diversity, budget)
  6. SideEffect – observe without modifying (logging, metrics)

Each trait converts to a Stage, the universal Kleisli arrow type. Stages compose via Stage::then (Kleisli composition). The final Pipeline is itself a single Stage from query to scored results.

§Categorical justification

Stage forms a category whose morphisms are Kleisli arrows A -> Io<E, B>. Composition is associative with identity, and by collapse::monad_is_kan every such composition is a pair of Kan extensions. Score implements JoinSemilattice, making score merging a colimit (left Kan extension).

Re-exports§

pub use error::PipelineError;
pub use filter::Filter;
pub use hydrator::Hydrator;
pub use pipeline::Pipeline;
pub use score::Score;
pub use score::ScoredCandidate;
pub use scorer::Scorer;
pub use selector::Budget;
pub use selector::MaxItems;
pub use selector::Selector;
pub use side_effect::SideEffect;
pub use source::Source;
pub use stage::Stage;

Modules§

error
Pipeline error types.
filter
Candidate filtering: removing items that fail criteria.
hydrator
Candidate hydration: enriching items with additional data.
pipeline
Pipeline composition: wiring stages into a complete pipeline.
score
Score and scored candidate types.
scorer
Candidate scoring: assigning relevance scores.
selector
Candidate selection: choosing final results.
side_effect
Side effects: observing candidates without modifying them.
source
Candidate sources.
stage
The Kleisli arrow type: the categorical heart of the pipeline.